1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-08-11 01:04:07 +02:00

refactor: use cross

This commit is contained in:
Justin Lin
2022-04-11 11:31:14 +08:00
parent 71f2156d3e
commit ad760d1f4a

View File

@@ -1,9 +1,4 @@
function tri_is_ccw(shape_pts) =
let(
p1 = shape_pts[0],
p2 = shape_pts[1],
p3 = shape_pts[2],
area = (p2[0] - p1[0]) * (p3[1] - p1[1]) - (p3[0] - p1[0]) * (p2[1] - p1[1])
)
let(area = cross(shape_pts[1] - shape_pts[0], shape_pts[2] - shape_pts[0]))
assert(area != 0, "points are collinear")
area > 0;