diff --git a/test/runtests.jl b/test/runtests.jl index 69c255e..8a2372f 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -36,6 +36,7 @@ include("test_sh_intersection.jl") include("test_isinside.jl") include("test_jctweld.jl") include("test_isinclosure.jl") +include("test_permute_vertices.jl") include("test_trgauss.jl") include("test_chartquad.jl") diff --git a/test/test_permute_vertices.jl b/test/test_permute_vertices.jl new file mode 100644 index 0000000..a095eff --- /dev/null +++ b/test/test_permute_vertices.jl @@ -0,0 +1,34 @@ +using CompScienceMeshes +using Test + +splx = simplex( + point(0,0,0), + point(1,0,0), + point(0,1,0) +); + +@test normal(splx) ≈ point(0,0,1) + +splx1 = CompScienceMeshes.permute_vertices(splx, [2,1,3]) +@test normal(splx1) ≈ point(0,0,1) + +splx2 = CompScienceMeshes.flip_normal(splx) +@test normal(splx2) ≈ point(0,0,-1) + +for i in 1:2 + @test CompScienceMeshes.tangents(splx2,i) ≈ CompScienceMeshes.tangents(splx,i) +end + +splx3 = simplex( + point(1,0.5,0), + point(-1,0.5,0), + point(-1,2.5,0) +) + +isct = CompScienceMeshes.intersection2(splx, splx3) +@test length(isct) == 1 + +splx4, splx5 = isct[1] +@test volume(splx4) ≈ volume(splx5) +@test normal(splx4) ≈ -normal(splx5) +