fix tests

This commit is contained in:
Adrian Mariano 2021-04-22 06:28:23 -04:00
parent 493ef62826
commit d91a48ef28
2 changed files with 5 additions and 11 deletions

View file

@ -92,6 +92,11 @@ module test_project_plane() {
assert_approx(project_plane([2,3,4,2], [[1,1,1],[0,0,0]]),[[0.430748825729,0.146123238594],[0,0]]);
assert_approx(project_plane([2,3,4,2]),[[0.920855800833,-0.11871629875,-0.371390676354,0],[-0.11871629875,0.821925551875,-0.557086014531,-2.77555756156e-17],[0.371390676354,0.557086014531,0.742781352708,-0.371390676354],[0,0,0,1]]);
assert_approx(project_plane([[1,1,1],[3,1,3],[1,1,4]]),[[-1/sqrt(2),1/sqrt(2),0,0],[0,0,1,-1],[1/sqrt(2),1/sqrt(2),0,-sqrt(2)],[0,0,0,1]]);
normal = rands(-1,1,3,seed=3)+[2,0,0];
offset = rands(-1,1,1,seed=4)[0];
assert_approx(project_plane([0,0,1,offset]),move([0,0,-offset]) );
assert_approx(project_plane([0,1,0,offset]),xrot(90)*move([0,-offset,0]) );
}
test_project_plane();

View file

@ -42,7 +42,6 @@ test_plane_from_points();
test_plane_from_polygon();
test_plane_normal();
test_plane_offset();
test_plane_transform();
test_projection_on_plane();
test_plane_point_nearest_origin();
test_distance_from_plane();
@ -175,16 +174,6 @@ module test_plane_point_nearest_origin(){
test_plane_point_nearest_origin();
module test_plane_transform(){
normal = rands(-1,1,3)+[2,0,0];
offset = rands(-1,1,1)[0];
info = info_str([["normal = ",normal],["offset = ",offset]]);
assert_approx(plane_transform([0,0,1,offset]),move([0,0,-offset]),info );
assert_approx(plane_transform([0,1,0,offset]),xrot(90)*move([0,-offset,0]),info );
}
*test_plane_transform();
module test_plane_offset(){
plane = rands(-1,1,4)+[2,0,0,0]; // a valid plane
info = info_str([["plane = ",plane]]);