You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by kw...@apache.org on 2018/06/19 06:47:38 UTC
lucene-solr:branch_6x: LUCENE-8363: Interpolate should yield points
on the ellipsoid.
Repository: lucene-solr
Updated Branches:
refs/heads/branch_6x 63d7f5d90 -> e27cf653c
LUCENE-8363: Interpolate should yield points on the ellipsoid.
Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/e27cf653
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/e27cf653
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/e27cf653
Branch: refs/heads/branch_6x
Commit: e27cf653c7b09bb2acfb0c0fa49e99d2eef48d53
Parents: 63d7f5d
Author: Karl Wright <Da...@gmail.com>
Authored: Tue Jun 19 02:31:40 2018 -0400
Committer: Karl Wright <Da...@gmail.com>
Committed: Tue Jun 19 02:47:29 2018 -0400
----------------------------------------------------------------------
.../lucene/spatial3d/geom/GeoComplexPolygon.java | 2 +-
.../java/org/apache/lucene/spatial3d/geom/Plane.java | 13 ++++++++-----
.../org/apache/lucene/spatial3d/geom/PlaneTest.java | 2 +-
3 files changed, 10 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/e27cf653/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 64f8f87..580338d 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
@@ -706,7 +706,7 @@ class GeoComplexPolygon extends GeoBasePolygon {
this.plane = new Plane(startPoint, endPoint);
this.startPlane = new SidedPlane(endPoint, plane, startPoint);
this.endPlane = new SidedPlane(startPoint, plane, endPoint);
- final GeoPoint interpolationPoint = plane.interpolate(startPoint, endPoint, halfProportions)[0];
+ final GeoPoint interpolationPoint = plane.interpolate(pm, startPoint, endPoint, halfProportions)[0];
this.backingPlane = new SidedPlane(interpolationPoint, interpolationPoint, 0.0);
this.planeBounds = new XYZBounds();
this.planeBounds.addPoint(startPoint);
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/e27cf653/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/Plane.java
----------------------------------------------------------------------
diff --git a/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/Plane.java b/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/Plane.java
index d03e624..1f9339c 100755
--- a/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/Plane.java
+++ b/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/Plane.java
@@ -465,12 +465,13 @@ public class Plane extends Vector {
* Find points on the boundary of the intersection of a plane and the unit sphere,
* given a starting point, and ending point, and a list of proportions of the arc (e.g. 0.25, 0.5, 0.75).
* The angle between the starting point and ending point is assumed to be less than pi.
+ * @param planetModel is the planet model.
* @param start is the start point.
* @param end is the end point.
* @param proportions is an array of fractional proportions measured between start and end.
* @return an array of points corresponding to the proportions passed in.
*/
- public GeoPoint[] interpolate(final GeoPoint start, final GeoPoint end, final double[] proportions) {
+ public GeoPoint[] interpolate(final PlanetModel planetModel, final GeoPoint start, final GeoPoint end, final double[] proportions) {
// Steps:
// (1) Translate (x0,y0,z0) of endpoints into origin-centered place:
// x1 = x0 + D*A
@@ -595,7 +596,7 @@ public class Plane extends Vector {
final double sinNewAngle = Math.sin(newAngle);
final double cosNewAngle = Math.cos(newAngle);
final Vector newVector = new Vector(cosNewAngle * startMagnitude, sinNewAngle * startMagnitude, 0.0);
- returnValues[i] = reverseModify(newVector, transX, transY, transZ, sinRA, cosRA, sinHA, cosHA);
+ returnValues[i] = reverseModify(planetModel, newVector, transX, transY, transZ, sinRA, cosRA, sinHA, cosHA);
}
return returnValues;
@@ -620,6 +621,7 @@ public class Plane extends Vector {
/**
* Reverse modify a point to produce a GeoPoint in normal space.
+ * @param planetModel is the planet model.
* @param point is the translated point.
* @param transX is the translation x value.
* @param transY is the translation y value.
@@ -630,10 +632,11 @@ public class Plane extends Vector {
* @param cosHA is the cosine of the height angle.
* @return the original point.
*/
- protected static GeoPoint reverseModify(final Vector point, final double transX, final double transY, final double transZ,
- final double sinRA, final double cosRA, final double sinHA, final double cosHA) {
+ protected static GeoPoint reverseModify(final PlanetModel planetModel,
+ final Vector point, final double transX, final double transY, final double transZ,
+ final double sinRA, final double cosRA, final double sinHA, final double cosHA) {
final Vector result = point.rotateXZ(-sinHA, cosHA).rotateXY(-sinRA, cosRA).translate(-transX, -transY, -transZ);
- return new GeoPoint(result.x, result.y, result.z);
+ return planetModel.createSurfacePoint(result.x, result.y, result.z);
}
/**
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/e27cf653/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/geom/PlaneTest.java
----------------------------------------------------------------------
diff --git a/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/geom/PlaneTest.java b/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/geom/PlaneTest.java
index 293da3f..766e067 100644
--- a/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/geom/PlaneTest.java
+++ b/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/geom/PlaneTest.java
@@ -63,7 +63,7 @@ public class PlaneTest {
// [A=-0.6135342247741855, B=0.21504338363863665, C=0.28188192383666794, D=0.0, side=-1.0] internal? false;
final Plane p = new Plane(-0.6135342247741855, 0.21504338363863665, 0.28188192383666794, 0.0);
- final GeoPoint[] points = p.interpolate(start, end, new double[]{0.25, 0.50, 0.75});
+ final GeoPoint[] points = p.interpolate(PlanetModel.SPHERE, start, end, new double[]{0.25, 0.50, 0.75});
for (GeoPoint point : points) {
assertTrue(p.evaluateIsZero(point));