mirror of
https://github.com/BelfrySCAD/BOSL2.git
synced 2025-01-01 09:49:45 +00:00
Minor tweak
This commit is contained in:
parent
5062ee1605
commit
dab6407b0f
1 changed files with 3 additions and 3 deletions
|
@ -1772,7 +1772,7 @@ function furthest_point(pt, points) =
|
||||||
// area = polygon_area(poly);
|
// area = polygon_area(poly);
|
||||||
// Description:
|
// Description:
|
||||||
// Given a 2D or 3D planar polygon, returns the area of that polygon.
|
// Given a 2D or 3D planar polygon, returns the area of that polygon.
|
||||||
// If the polygon is self-crossing, the results are undefined. For non-planar 3D polygon the result is undef.
|
// If the polygon is self-crossing, the results are undefined. For non-planar 3D polygon the result is [].
|
||||||
// When `signed` is true, a signed area is returned; a positive area indicates a clockwise polygon.
|
// When `signed` is true, a signed area is returned; a positive area indicates a clockwise polygon.
|
||||||
// Arguments:
|
// Arguments:
|
||||||
// poly = Polygon to compute the area of.
|
// poly = Polygon to compute the area of.
|
||||||
|
@ -1784,9 +1784,9 @@ function polygon_area(poly, signed=false) =
|
||||||
? let( total = sum([for(i=[1:1:len(poly)-2]) cross(poly[i]-poly[0],poly[i+1]-poly[0]) ])/2 )
|
? let( total = sum([for(i=[1:1:len(poly)-2]) cross(poly[i]-poly[0],poly[i+1]-poly[0]) ])/2 )
|
||||||
signed ? total : abs(total)
|
signed ? total : abs(total)
|
||||||
: let( plane = plane_from_polygon(poly) )
|
: let( plane = plane_from_polygon(poly) )
|
||||||
plane==undef? undef :
|
plane==[]? [] :
|
||||||
let(
|
let(
|
||||||
n = plane_normal(plane),
|
n = plane_normal(plane),
|
||||||
total = sum([
|
total = sum([
|
||||||
for(i=[1:1:len(poly)-2])
|
for(i=[1:1:len(poly)-2])
|
||||||
let(
|
let(
|
||||||
|
|
Loading…
Reference in a new issue