fixed AFront

This commit is contained in:
zzzzrrr 2009-08-05 19:40:58 -04:00
parent 552b5a76b8
commit 2510a728a7

View File

@ -261,6 +261,7 @@ class CDT(val points: List[Point], val segments: List[Segment], iTriangle: Trian
val points = new ArrayBuffer[Point] val points = new ArrayBuffer[Point]
var node = aFront.locate(point1) var node = aFront.locate(point1)
val first = node
while(node.point != point2) { while(node.point != point2) {
points += node.point points += node.point
@ -268,9 +269,13 @@ class CDT(val points: List[Point], val segments: List[Segment], iTriangle: Trian
} }
// STEP 3: Triangulate empty areas. // STEP 3: Triangulate empty areas.
triangulateEmpty(point1, point2, points) val T = new ArrayBuffer[Triangle]
triangulate(points.toArray, List(point1, point2), T)
// TODO: Update AFront before pushing changes!!!!! // Update advancing front
first.triangle = T.first
first.next = node
node.prev = first
// TODO: Update Delauney Edge Pointers // TODO: Update Delauney Edge Pointers
@ -280,12 +285,6 @@ class CDT(val points: List[Point], val segments: List[Segment], iTriangle: Trian
} }
// Triangulate empty areas.
def triangulateEmpty(point1: Point, point2: Point, points: ArrayBuffer[Point]) {
val T = new ArrayBuffer[Triangle]
triangulate(points.toArray, List(point1, point2), T)
}
// Marc Vigo Anglada's triangulate pseudo-polygon algo // Marc Vigo Anglada's triangulate pseudo-polygon algo
private def triangulate(P: Array[Point], ab: List[Point], T: ArrayBuffer[Triangle]) { private def triangulate(P: Array[Point], ab: List[Point], T: ArrayBuffer[Triangle]) {