Fixed broken line-plane intersections. Attachment enhanced vnf_polyhedron().

This commit is contained in:
Garth Minette
2020-08-28 19:07:10 -07:00
parent 7051f8ef19
commit e1b0985afc
5 changed files with 49 additions and 19 deletions

View File

@@ -53,7 +53,7 @@ test_tri_functions();
//test__general_plane_line_intersection();
//test_plane_line_angle();
//test_plane_line_intersection();
//test_polygon_line_intersection();
test_polygon_line_intersection();
//test_plane_intersection();
test_coplanar();
test_points_on_plane();
@@ -542,6 +542,17 @@ module test_distance_from_plane() {
*test_distance_from_plane();
module test_polygon_line_intersection() {
poly1 = [[50,50,50], [50,-50,50], [-50,-50,50]];
assert_approx(polygon_line_intersection(poly1, [CENTER, UP]), [0,0,50]);
assert_approx(polygon_line_intersection(poly1, [CENTER, UP+RIGHT]), [50,0,50]);
assert_approx(polygon_line_intersection(poly1, [CENTER, UP+BACK+RIGHT]), [50,50,50]);
assert_approx(polygon_line_intersection(poly1, [[0,0,50], [1,0,50]]), [[[0,0,50], [50,0,50]]]);
assert_approx(polygon_line_intersection(poly1, [[0,0,0], [1,0,0]]), undef);
}
*test_polygon_line_intersection();
module test_coplanar() {
assert(coplanar([ [5,5,1],[0,0,1],[-1,-1,1] ]) == false);
assert(coplanar([ [5,5,1],[0,0,0],[-1,-1,1] ]) == true);