From 5f651233d8b929f0ecec61a8127940fb029365c0 Mon Sep 17 00:00:00 2001 From: zzzzrrr Date: Thu, 16 Jul 2009 09:30:30 -0400 Subject: [PATCH] removed unessary case 4 query graph pointer magic --- src/org/poly2tri/QueryGraph.scala | 10 ++-------- src/org/poly2tri/XNode.scala | 9 ++------- 2 files changed, 4 insertions(+), 15 deletions(-) diff --git a/src/org/poly2tri/QueryGraph.scala b/src/org/poly2tri/QueryGraph.scala index f950b5c..3a6bc35 100644 --- a/src/org/poly2tri/QueryGraph.scala +++ b/src/org/poly2tri/QueryGraph.scala @@ -86,13 +86,7 @@ class QueryGraph(var head: Node) { def case4(sink: Sink, s: Segment, tList: ArrayBuffer[Trapezoid]) { 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))) - replace(sink, qNode) - } + val qNode = new XNode(new Point(s.q.x, s.q.y, s), yNode, Sink.init(tList(2))) + replace(sink, qNode) } } diff --git a/src/org/poly2tri/XNode.scala b/src/org/poly2tri/XNode.scala index e923433..f684083 100644 --- a/src/org/poly2tri/XNode.scala +++ b/src/org/poly2tri/XNode.scala @@ -37,16 +37,11 @@ class XNode(point: Point, lChild: Node, rChild: Node) extends Node(lChild, rChil // Move to the right in the graph return right.locate(s) } else if(s.p.x == point.x) { - if(point.y > s.p.y) { - s.left = point.segment.below - } else { - s.left = point.segment.above - } + // Move to the right in the graph return right.locate(s) } else { // Move to the left in the graph return left.locate(s) } } - -} +} \ No newline at end of file