@@ -12,7 +12,6 @@ function dir(dart::Dart)
1212end
1313
1414
15-
1615function getedges (s:: Face )
1716 edges = Edge[]
1817 for loop in s. loops
@@ -47,7 +46,6 @@ function getpoints(s::Face)
4746end
4847
4948
50-
5149function getpoints (v:: Volume )
5250 points = Set {Point} ()
5351 for spin in v. spins
@@ -59,7 +57,6 @@ function getpoints(v::Volume)
5957end
6058
6159
62-
6360function is_neighbor (surf1:: Face , surf2:: Face )
6461 for dart in surf1. loops[1 ]. darts
6562 for s in dart. edge. faces
7168
7269
7370
74-
7571function in_segment (X, X1, X2)
7672 tol = 1e-6
7773 X1X = X- X1
@@ -115,21 +111,6 @@ function point_in_edge(p::Point, l::Edge)
115111end
116112
117113
118- function coplanar (face:: Face , points:: Vector{Point} )
119- face. flat || return false
120- tol = 1e-6 # reduced tolerance
121-
122- normal = getnormal (face. loops[1 ])
123- p1 = face. loops[1 ]. darts[1 ]. points[1 ]
124-
125- for p in points # check if every point is in the plane
126- abs (dot (p. coord - p1. coord, normal)) > tol && return false
127- end
128-
129- return true
130- end
131-
132-
133114function split_edge (geo:: GeoModel , edge:: Edge , point:: Point )
134115
135116 p1 = edge. points[1 ]
@@ -180,9 +161,6 @@ function split_edge(geo::GeoModel, edge::Edge, point::Point)
180161end
181162
182163
183-
184-
185-
186164function intersection (l1:: Edge , l2:: Edge )
187165 # Assumes:
188166 # L1: P = P1 +V1*t
@@ -236,9 +214,6 @@ function parallel(dart1::Dart, dart2::Dart)
236214end
237215
238216
239-
240-
241-
242217function colinear (points:: Vector{Point} )
243218 length (points)< 2 && return true
244219 tol = 1e-6
@@ -260,6 +235,7 @@ function colinear(points::Vector{Point})
260235end
261236
262237
238+ # Get a directed normal vector even if the loop is not flat
263239function getnormal (loop:: Loop )
264240 C = getcoords (loop. points)
265241
@@ -295,6 +271,21 @@ function getnormal(loop::Loop)
295271end
296272
297273
274+ function coplanar (face:: Face , points:: Vector{Point} )
275+ face. flat || return false
276+ tol = 1e-6 # reduced tolerance
277+
278+ normal = getnormal (face. loops[1 ])
279+ p1 = face. loops[1 ]. darts[1 ]. points[1 ]
280+
281+ for p in points # check if every point is in the plane
282+ abs (dot (p. coord - p1. coord, normal)) > tol && return false
283+ end
284+
285+ return true
286+ end
287+
288+
298289function coplanar (points:: Vector{Point} )
299290 n = length (points)
300291 n<= 3 && return true
0 commit comments