lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kris...@apache.org
Subject [09/11] lucene-solr:jira/solr-8593: LUCENE-7241: Another minor optimization.
Date Thu, 05 May 2016 13:42:01 GMT
LUCENE-7241: Another minor optimization.


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/551d267f
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/551d267f
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/551d267f

Branch: refs/heads/jira/solr-8593
Commit: 551d267ff5bbf2f5a7ba46aa9725f2fa5a3ba046
Parents: 940281b
Author: Karl Wright <DaddyWri@gmail.com>
Authored: Thu May 5 03:36:53 2016 -0400
Committer: Karl Wright <DaddyWri@gmail.com>
Committed: Thu May 5 03:36:53 2016 -0400

----------------------------------------------------------------------
 .../spatial3d/geom/GeoComplexPolygon.java       | 24 +++++++-------------
 1 file changed, 8 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/551d267f/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoComplexPolygon.java
----------------------------------------------------------------------
diff --git a/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoComplexPolygon.java
b/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoComplexPolygon.java
index 25a3d15..f2d2424 100644
--- a/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoComplexPolygon.java
+++ b/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoComplexPolygon.java
@@ -284,7 +284,7 @@ class GeoComplexPolygon extends GeoBasePolygon {
       assert bestDistance > 0.0 : "Best distance should not be zero unless on single plane";
       assert bestDistance < Double.MAX_VALUE : "Couldn't find an intersection point of
any kind";
       
-      final DualCrossingEdgeIterator edgeIterator = new DualCrossingEdgeIterator(firstLegPlane,
firstLegAbovePlane, firstLegBelowPlane, secondLegPlane, testPoint, thePoint, intersectionPoint);
+      final DualCrossingEdgeIterator edgeIterator = new DualCrossingEdgeIterator(firstLegPlane,
firstLegAbovePlane, firstLegBelowPlane, secondLegPlane, thePoint, intersectionPoint);
       if (!firstLegTree.traverse(edgeIterator, firstLegValue)) {
         return true;
       }
@@ -842,7 +842,7 @@ class GeoComplexPolygon extends GeoBasePolygon {
     public int crossingCount = 0;
 
     public DualCrossingEdgeIterator(final Plane testPointPlane, final Plane testPointAbovePlane,
final Plane testPointBelowPlane,
-      final Plane travelPlane, final Vector testPoint, final Vector thePoint, final GeoPoint
intersectionPoint) {
+      final Plane travelPlane, final Vector thePoint, final GeoPoint intersectionPoint) {
       this.testPointPlane = testPointPlane;
       this.testPointAbovePlane = testPointAbovePlane;
       this.testPointBelowPlane = testPointBelowPlane;
@@ -992,19 +992,6 @@ class GeoComplexPolygon extends GeoBasePolygon {
         
       // Plane crossing, either first leg or second leg
       
-      final Plane plane;
-      final SidedPlane bound1;
-      final SidedPlane bound2;
-      if (isSecondLeg) {
-        plane = travelPlane;
-        bound1 = checkPointCutoffPlane;
-        bound2 = checkPointOtherCutoffPlane;
-      } else {
-        plane = testPointPlane;
-        bound1 = testPointCutoffPlane;
-        bound2 = testPointOtherCutoffPlane;
-      }
-        
       if (crossingPoint.isNumericallyIdentical(edge.startPoint)) {
         //System.err.println(" Crossing point = edge.startPoint");
         // We have to figure out if this crossing should be counted.
@@ -1055,7 +1042,12 @@ class GeoComplexPolygon extends GeoBasePolygon {
         // a decision whether to count or not based on that.
           
         // Compute the crossing points of this other edge.
-        final GeoPoint[] otherCrossingPoints = plane.findCrossings(planetModel, assessEdge.plane,
bound1, bound2, assessEdge.startPlane, assessEdge.endPlane);
+        final GeoPoint[] otherCrossingPoints;
+        if (isSecondLeg) {
+          otherCrossingPoints = travelPlane.findCrossings(planetModel, assessEdge.plane,
checkPointCutoffPlane, checkPointOtherCutoffPlane, assessEdge.startPlane, assessEdge.endPlane);
+        } else {
+          otherCrossingPoints = testPointPlane.findCrossings(planetModel, assessEdge.plane,
testPointCutoffPlane, testPointOtherCutoffPlane, assessEdge.startPlane, assessEdge.endPlane);
+        }        
           
         // Look for a matching endpoint.  If the other endpoint doesn't show up, it is either
out of bounds (in which case the
         // transition won't be counted for that edge), or it is not a crossing for that edge
(so, same conclusion).


Mime
View raw message