mirror of
https://github.com/jhasse/poly2tri.git
synced 2024-11-05 22:09:52 +01:00
updated comments
This commit is contained in:
parent
690f0e138c
commit
122b2d6f40
@ -189,14 +189,15 @@ class CDT(polyLine: Array[Point], clearPoint: Point) {
|
||||
// Locate the first intersected triangle
|
||||
val firstTriangle = node.triangle.locateFirst(edge)
|
||||
|
||||
// Remove intersected triangles
|
||||
if(firstTriangle != null && !firstTriangle.contains(edge)) {
|
||||
|
||||
|
||||
// Constrained edge lies below the advancing front. Traverse through intersected triangles,
|
||||
// form empty pseudo-polygons, and re-triangulate
|
||||
|
||||
// Collect intersected triangles
|
||||
val tList = new ArrayBuffer[Triangle]
|
||||
tList += firstTriangle
|
||||
|
||||
// Not sure why tList.last is null sometimes....
|
||||
while(!tList.last.contains(edge.p))
|
||||
tList += tList.last.findNeighbor(edge.p)
|
||||
|
||||
@ -210,6 +211,7 @@ class CDT(polyLine: Array[Point], clearPoint: Point) {
|
||||
mesh.map -= t
|
||||
})
|
||||
|
||||
// Using a hashMap or set may improve performance
|
||||
val lPoints = new ArrayBuffer[Point]
|
||||
val rPoints = new ArrayBuffer[Point]
|
||||
|
||||
@ -263,7 +265,7 @@ class CDT(polyLine: Array[Point], clearPoint: Point) {
|
||||
} else if(firstTriangle == null) {
|
||||
|
||||
// No triangles are intersected by the edge; edge must lie outside the mesh
|
||||
// Apply constraint; traverse the AFront, and build triangles
|
||||
// Apply constraint; traverse the advancing front, and build triangles
|
||||
|
||||
val ahead = (edge.p.x > edge.q.x)
|
||||
val point1 = if(ahead) edge.q else edge.p
|
||||
@ -299,11 +301,12 @@ class CDT(polyLine: Array[Point], clearPoint: Point) {
|
||||
T.last markEdge(point1, point2)
|
||||
|
||||
} else if(firstTriangle.contains(edge.q, edge.p)) {
|
||||
// Constrained edge lies on the side of a triangle
|
||||
// Mark constrained edge
|
||||
firstTriangle markEdge(edge.q, edge.p)
|
||||
firstTriangle.finalized = true
|
||||
} else {
|
||||
throw new Exception("Triangulation error")
|
||||
throw new Exception("Triangulation error - unexpected case")
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user