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]
|
val T2 = new ArrayBuffer[Triangle]
|
||||||
triangulate(rPoints.toArray, List(edge.q, edge.p), T2)
|
triangulate(rPoints.toArray, List(edge.q, edge.p), T2)
|
||||||
|
|
||||||
|
// Update neighbors
|
||||||
|
edgeNeighbors(nTriangles, T1)
|
||||||
|
edgeNeighbors(nTriangles, T2)
|
||||||
|
|
||||||
// Update advancing front
|
// Update advancing front
|
||||||
|
|
||||||
val ahead = (edge.p.x > edge.q.x)
|
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 sNode = aFront.locate(point1)
|
||||||
val eNode = aFront.locate(point2)
|
val eNode = aFront.locate(point2)
|
||||||
|
|
||||||
// Update neighbors
|
val eTri = aFront.constrainedEdge(sNode, eNode, T2, edge)
|
||||||
edgeNeighbors(nTriangles, T1)
|
|
||||||
edgeNeighbors(nTriangles, T2)
|
|
||||||
|
|
||||||
aFront.constrainedEdge(sNode, eNode, T2, edge)
|
// Mark edge triangle neighbors
|
||||||
|
//T1.foreach(t => t.markNeighbor(eTri))
|
||||||
|
|
||||||
|
eTri
|
||||||
|
|
||||||
} else if(firstTriangle == null) {
|
} else if(firstTriangle == null) {
|
||||||
|
|
||||||
@ -273,13 +278,15 @@ class CDT(val points: List[Point], val segments: List[Segment], iTriangle: Trian
|
|||||||
|
|
||||||
// Triangulate empty areas.
|
// Triangulate empty areas.
|
||||||
val T = new ArrayBuffer[Triangle]
|
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
|
// Select edge triangle
|
||||||
var edgeTri: Triangle = null
|
var edgeTri: Triangle = null
|
||||||
var i = 0
|
var i = 0
|
||||||
while(edgeTri == null) {
|
while(edgeTri == null) {
|
||||||
if(T(i).contains(first.point, node.point))
|
if(T(i).contains(point1, point2))
|
||||||
edgeTri = T(i)
|
edgeTri = T(i)
|
||||||
i += 1
|
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 pC = if(ccw) b else P(i)
|
||||||
val points = Array(a, P(i), b)
|
val points = Array(a, P(i), b)
|
||||||
T += new Triangle(points)
|
T += new Triangle(points)
|
||||||
|
T.last.finalized = true
|
||||||
mesh.map += T.last
|
mesh.map += T.last
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user