mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-08-13 10:14:41 +02:00
refactor: use cross
This commit is contained in:
@@ -1,9 +1,4 @@
|
|||||||
function tri_is_ccw(shape_pts) =
|
function tri_is_ccw(shape_pts) =
|
||||||
let(
|
let(area = cross(shape_pts[1] - shape_pts[0], shape_pts[2] - shape_pts[0]))
|
||||||
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])
|
|
||||||
)
|
|
||||||
assert(area != 0, "points are collinear")
|
assert(area != 0, "points are collinear")
|
||||||
area > 0;
|
area > 0;
|
Reference in New Issue
Block a user