mirror of
https://github.com/revarbat/BOSL2.git
synced 2025-08-20 13:51:55 +02:00
Added reverse_polygon() and improved ccw_polygon() and clockwise_polygon()
This commit is contained in:
@@ -655,20 +655,31 @@ test_polygon_is_clockwise();
|
||||
|
||||
module test_clockwise_polygon() {
|
||||
path = circle(d=100);
|
||||
rpath = concat([path[0]], reverse(select(path,1,-1)));
|
||||
assert(clockwise_polygon(path) == path);
|
||||
assert(clockwise_polygon(reverse(path)) == path);
|
||||
assert(clockwise_polygon(rpath) == path);
|
||||
}
|
||||
test_clockwise_polygon();
|
||||
|
||||
|
||||
module test_ccw_polygon() {
|
||||
path = circle(d=100);
|
||||
assert(ccw_polygon(path) == reverse(path));
|
||||
assert(ccw_polygon(reverse(path)) == reverse(path));
|
||||
rpath = concat([path[0]], reverse(select(path,1,-1)));
|
||||
assert(ccw_polygon(path) == rpath);
|
||||
assert(ccw_polygon(rpath) == rpath);
|
||||
}
|
||||
test_ccw_polygon();
|
||||
|
||||
|
||||
module test_reverse_polygon() {
|
||||
path = circle(d=100);
|
||||
rpath = concat([path[0]], reverse(select(path,1,-1)));
|
||||
assert(reverse_polygon(path) == rpath);
|
||||
assert(reverse_polygon(rpath) == path);
|
||||
}
|
||||
test_reverse_polygon();
|
||||
|
||||
|
||||
module test_is_region() {
|
||||
assert(is_region([circle(d=10),square(10)]));
|
||||
assert(is_region([circle(d=10),square(10),circle(d=50)]));
|
||||
|
Reference in New Issue
Block a user