mirror of
https://github.com/revarbat/BOSL2.git
synced 2025-08-20 12:32:29 +02:00
usage message fixes and doc tweaks
remove triangle area, optimize polygon_area for triangles
This commit is contained in:
@@ -120,6 +120,10 @@ test_is_decreasing();
|
||||
module test_find_approx() {
|
||||
assert(find_approx(1, [2,3,1.05,4,1,2,.99], eps=.1)==2);
|
||||
assert(find_approx(1, [2,3,1.05,4,1,2,.99], all=true, eps=.1)==[2,4,6]);
|
||||
assert(find_approx(1, [2,3,4])==undef);
|
||||
assert(find_approx(1, [2,3,4],all=true)==[]);
|
||||
assert(find_approx(1, [])==undef);
|
||||
assert(find_approx(1, [], all=true)==[]);
|
||||
}
|
||||
test_find_approx();
|
||||
|
||||
|
@@ -768,9 +768,9 @@ module test_polygon_area() {
|
||||
assert(approx(polygon_area(rot([13,27,75],
|
||||
p=path3d(circle(r=50,$fn=1000),fill=23)),
|
||||
signed=true), PI*50*50, eps=0.1));
|
||||
assert(abs(triangle_area([0,0], [0,10], [10,0]) + 50) < EPSILON);
|
||||
assert(abs(triangle_area([0,0], [0,10], [0,15])) < EPSILON);
|
||||
assert(abs(triangle_area([0,0], [10,0], [0,10]) - 50) < EPSILON);
|
||||
assert(abs(polygon_area([[0,0], [0,10], [10,0]],signed=true) + 50) < EPSILON);
|
||||
assert(abs(polygon_area([[0,0], [0,10], [0,15]],signed=true)) < EPSILON);
|
||||
assert(abs(polygon_area([[0,0], [10,0], [0,10]],signed=true) - 50) < EPSILON);
|
||||
|
||||
}
|
||||
*test_polygon_area();
|
||||
|
@@ -29,6 +29,8 @@ module test_is_vector() {
|
||||
assert(is_vector([1,1,1],all_nonzero=true) == true);
|
||||
assert(is_vector([-1,1,1],all_nonzero=true) == true);
|
||||
assert(is_vector([-1,-1,-1],all_nonzero=true) == true);
|
||||
assert(!is_vector([3,INF,4]));
|
||||
assert(!is_vector([3,NAN,4]));
|
||||
}
|
||||
test_is_vector();
|
||||
|
||||
|
Reference in New Issue
Block a user