mirror of
https://github.com/jhasse/poly2tri.git
synced 2024-11-30 01:03:30 +01:00
fixed point bug
This commit is contained in:
parent
e827825e47
commit
6a08aca82f
@ -231,6 +231,10 @@ class CDT(val points: List[Point], val segments: List[Segment], iTriangle: Trian
|
||||
val T2 = new ArrayBuffer[Triangle]
|
||||
triangulate(rPoints.toArray, List(edge.q, edge.p), T2)
|
||||
|
||||
// Update neighbors
|
||||
edgeNeighbors(nTriangles, T1)
|
||||
edgeNeighbors(nTriangles, T2)
|
||||
|
||||
// Update advancing front
|
||||
|
||||
val ahead = (edge.p.x > edge.q.x)
|
||||
@ -240,11 +244,12 @@ class CDT(val points: List[Point], val segments: List[Segment], iTriangle: Trian
|
||||
val sNode = aFront.locate(point1)
|
||||
val eNode = aFront.locate(point2)
|
||||
|
||||
// Update neighbors
|
||||
edgeNeighbors(nTriangles, T1)
|
||||
edgeNeighbors(nTriangles, T2)
|
||||
val eTri = aFront.constrainedEdge(sNode, eNode, T2, edge)
|
||||
|
||||
aFront.constrainedEdge(sNode, eNode, T2, edge)
|
||||
// Mark edge triangle neighbors
|
||||
//T1.foreach(t => t.markNeighbor(eTri))
|
||||
|
||||
eTri
|
||||
|
||||
} else if(firstTriangle == null) {
|
||||
|
||||
@ -273,13 +278,15 @@ class CDT(val points: List[Point], val segments: List[Segment], iTriangle: Trian
|
||||
|
||||
// Triangulate empty areas.
|
||||
val T = new ArrayBuffer[Triangle]
|
||||
triangulate(points.toArray, List(edge.q, edge.p), T)
|
||||
triangulate(points.toArray, List(point1, point2), T)
|
||||
|
||||
//T.foreach(t => mesh.debug += t)
|
||||
|
||||
// Select edge triangle
|
||||
var edgeTri: Triangle = null
|
||||
var i = 0
|
||||
while(edgeTri == null) {
|
||||
if(T(i).contains(first.point, node.point))
|
||||
if(T(i).contains(point1, point2))
|
||||
edgeTri = T(i)
|
||||
i += 1
|
||||
}
|
||||
@ -349,6 +356,7 @@ class CDT(val points: List[Point], val segments: List[Segment], iTriangle: Trian
|
||||
//val pC = if(ccw) b else P(i)
|
||||
val points = Array(a, P(i), b)
|
||||
T += new Triangle(points)
|
||||
T.last.finalized = true
|
||||
mesh.map += T.last
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user