@@ -85,16 +85,24 @@ using LinearAlgebra: dot, norm
85
85
resolution = 0.1
86
86
sdf = SignedDistanceField (f, bounds, resolution)
87
87
88
- for algorithm in (MarchingCubes (0.5 ),
89
- MarchingTetrahedra (0.5 ),
90
- NaiveSurfaceNets (0.5 ))
88
+ for algorithm in (MarchingCubes (0.5 ), MarchingTetrahedra (0.5 ))
91
89
mesh = @inferred GLNormalMesh (sdf, algorithm)
92
90
# should be centered on the origin
93
91
@test mean (vertices (mesh)) ≈ [0 , 0 , 0 ] atol= 0.15 * resolution
94
92
# and should be symmetric about the origin
95
93
@test maximum (vertices (mesh)) ≈ [0.5 , 0.5 , 0.5 ]
96
94
@test minimum (vertices (mesh)) ≈ [- 0.5 , - 0.5 , - 0.5 ]
97
95
end
96
+ # Naive Surface Nets has no accuracy guarantee, and is a weighted sum
97
+ # so a larger tolerance is needed for this one. In addition,
98
+ # quad -> triangle conversion is not functioning correctly
99
+ # see: https://github.com/JuliaGeometry/GeometryTypes.jl/issues/169
100
+ mesh = @inferred GLNormalMesh (sdf, NaiveSurfaceNets (0.5 ))
101
+ # should be centered on the origin
102
+ @test mean (vertices (mesh)) ≈ [0 , 0 , 0 ] atol= 0.15 * resolution
103
+ # and should be symmetric about the origin
104
+ @test maximum (vertices (mesh)) ≈ [0.5 , 0.5 , 0.5 ] atol= 0.2
105
+ @test minimum (vertices (mesh)) ≈ [- 0.5 , - 0.5 , - 0.5 ] atol= 0.2
98
106
end
99
107
100
108
@testset " AbstractMeshingAlgorithm interface" begin
@@ -172,10 +180,10 @@ using LinearAlgebra: dot, norm
172
180
0.1 , Float16) do v
173
181
(sqrt (v[1 ]^ 2 + v[2 ]^ 2 )- 0.5 )^ 2 + v[3 ]^ 2 - 0.25
174
182
end
175
- @test typeof (HomogenousMesh (sdf ,NaiveSurfaceNets ())) ==
176
- HomgenousMesh{ Face{4 ,Int},Point{ 3 ,Float16 }}
177
- m2 = HomogenousMesh (sdf ,MarchingTetrahedra ())
178
- m3 = HomogenousMesh (sdf ,MarchingCubes ())
183
+ @test typeof (HomogenousMesh (sdf_torus ,NaiveSurfaceNets ())) ==
184
+ PlainMesh{Float16, Face{4 ,Int}}
185
+ m2 = HomogenousMesh (sdf_torus ,MarchingTetrahedra ())
186
+ m3 = HomogenousMesh (sdf_torus ,MarchingCubes ())
179
187
end
180
188
end
181
189
end
0 commit comments