You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: test/geometrytypes.jl
+21-2Lines changed: 21 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -351,12 +351,31 @@ end
351
351
ns =normals(c)
352
352
# caps without mantle
353
353
f_ns =face_normals(coordinates(c), filter!(f -> f isa TriangleFace, faces(c)))
354
-
@testall(n -> n ==values(ns)[end-1], values(f_ns)[1:15])
355
-
@testall(n -> n ==values(ns)[end], values(f_ns)[16:end])
354
+
@testall(n -> n ≈values(ns)[end-1], values(f_ns)[1:15])
355
+
@testall(n -> n ≈values(ns)[end], values(f_ns)[16:end])
356
356
# Mantle without caps
357
357
v_ns =normals(coordinates(c), filter!(f -> f isa QuadFace, faces(c)))[1:end-2]
358
358
@testvalues(ns)[1:15] ≈ v_ns[1:15]
359
359
@testvalues(ns)[1:15] ≈ v_ns[16:30] # repeated via FaceView in ns
360
+
361
+
# Planar QuadFace with colinear edge
362
+
v = [Point{3,Float64}(0.0,0.0,0.0),Point{3,Float64}(1.0,0.0,0.0),Point{3,Float64}(2.0,0.0,0.0),Point{3,Float64}(2.0,1.0,0.0)]
363
+
f = [QuadFace{Int}(1,2,3,4)]
364
+
n =normals(v,f)
365
+
@testall(n_i -> n_i ≈ [0.0,0.0,1.0], n)
366
+
367
+
# Planar NgonFace (5-sided) with colinear edge
368
+
v = [Point{3,Float64}(0.0,0.0,0.0),Point{3,Float64}(1.0,0.0,0.0),Point{3,Float64}(2.0,0.0,0.0),Point{3,Float64}(2.0,1.0,0.0),Point{3,Float64}(2.0,0.5,0.0)]
369
+
f = [NgonFace{5,Int}(1,2,3,4,5)]
370
+
n =normals(v,f)
371
+
@testall(n_i -> n_i ≈ [0.0,0.0,1.0], n)
372
+
373
+
# Non-planar NgonFace (6 sided), features equal up and down variations resulting in z-dir average face_normal
374
+
t =range(0.0,2*pi-(2*pi)/6,6)
375
+
v = [Point{3,Float64}(cos(t[i]),sin(t[i]),iseven(i)) for i ineachindex(t)]
0 commit comments