removed unessary case 4 query graph pointer magic

This commit is contained in:
zzzzrrr 2009-07-16 09:30:30 -04:00
parent 4b40deb5db
commit 5f651233d8
2 changed files with 4 additions and 15 deletions

View File

@ -86,13 +86,7 @@ class QueryGraph(var head: Node) {
def case4(sink: Sink, s: Segment, tList: ArrayBuffer[Trapezoid]) { def case4(sink: Sink, s: Segment, tList: ArrayBuffer[Trapezoid]) {
val yNode = new YNode(s, Sink.init(tList(0)), Sink.init(tList(1))) val yNode = new YNode(s, Sink.init(tList(0)), Sink.init(tList(1)))
if(s.left != null) {
val pNode = new XNode(new Point(s.p.x, s.p.y, s), Sink.init(s.left), yNode)
val qNode = new XNode(new Point(s.q.x, s.q.y, s), pNode, Sink.init(tList(2)))
replace(sink, qNode)
} else {
val qNode = new XNode(new Point(s.q.x, s.q.y, s), yNode, Sink.init(tList(2))) val qNode = new XNode(new Point(s.q.x, s.q.y, s), yNode, Sink.init(tList(2)))
replace(sink, qNode) replace(sink, qNode)
} }
}
} }

View File

@ -37,16 +37,11 @@ class XNode(point: Point, lChild: Node, rChild: Node) extends Node(lChild, rChil
// Move to the right in the graph // Move to the right in the graph
return right.locate(s) return right.locate(s)
} else if(s.p.x == point.x) { } else if(s.p.x == point.x) {
if(point.y > s.p.y) { // Move to the right in the graph
s.left = point.segment.below
} else {
s.left = point.segment.above
}
return right.locate(s) return right.locate(s)
} else { } else {
// Move to the left in the graph // Move to the left in the graph
return left.locate(s) return left.locate(s)
} }
} }
} }