Fix up formatting

This commit is contained in:
Karl David Wright 2022-11-19 17:44:24 -05:00
parent 9bca7a70e1
commit 1e236090af
2 changed files with 48 additions and 47 deletions

View File

@ -17,11 +17,8 @@
package org.apache.lucene.spatial3d.geom; package org.apache.lucene.spatial3d.geom;
/** /**
* Generic shape that supports bounds. This describes methods that help * Generic shape that supports bounds. This describes methods that help shapes compute their bounds.
* shapes compute their bounds.
* *
* @lucene.experimental * @lucene.experimental
*/ */
public interface GeoBounds extends Bounded, Membership, PlanetObject { public interface GeoBounds extends Bounded, Membership, PlanetObject {}
}

View File

@ -189,20 +189,21 @@ class GeoStandardPath extends GeoBasePath {
onlyEndpoint.circlePlane.getSampleIntersectionPoint(planetModel, normalPlane) onlyEndpoint.circlePlane.getSampleIntersectionPoint(planetModel, normalPlane)
}; };
} else { } else {
// Create segment endpoints. Use an appropriate constructor for the start and end of the path. // Create segment endpoints. Use an appropriate constructor for the start and end of the
// path.
for (int i = 0; i < segments.size(); i++) { for (int i = 0; i < segments.size(); i++) {
final PathSegment currentSegment = segments.get(i); final PathSegment currentSegment = segments.get(i);
if (i == 0) { if (i == 0) {
// Starting endpoint // Starting endpoint
final SegmentEndpoint startEndpoint = final SegmentEndpoint startEndpoint =
new CutoffSingleCircleSegmentEndpoint( new CutoffSingleCircleSegmentEndpoint(
planetModel, planetModel,
null, null,
currentSegment.start, currentSegment.start,
currentSegment.startCutoffPlane, currentSegment.startCutoffPlane,
currentSegment.ULHC, currentSegment.ULHC,
currentSegment.LLHC); currentSegment.LLHC);
endPoints.add(startEndpoint); endPoints.add(startEndpoint);
this.edgePoints = new GeoPoint[] {currentSegment.ULHC}; this.edgePoints = new GeoPoint[] {currentSegment.ULHC};
continue; continue;
@ -214,43 +215,44 @@ class GeoStandardPath extends GeoBasePath {
&& prevSegment.endCutoffPlane.isWithin(currentSegment.LLHC) && prevSegment.endCutoffPlane.isWithin(currentSegment.LLHC)
&& currentSegment.startCutoffPlane.isWithin(prevSegment.URHC) && currentSegment.startCutoffPlane.isWithin(prevSegment.URHC)
&& currentSegment.startCutoffPlane.isWithin(prevSegment.LRHC)) { && currentSegment.startCutoffPlane.isWithin(prevSegment.LRHC)) {
// The planes are identical. We wouldn't need a circle at all except for the possibility of // The planes are identical. We wouldn't need a circle at all except for the possibility
// of
// backing up, which is hard to detect here. // backing up, which is hard to detect here.
final SegmentEndpoint midEndpoint = final SegmentEndpoint midEndpoint =
new CutoffSingleCircleSegmentEndpoint( new CutoffSingleCircleSegmentEndpoint(
planetModel, planetModel,
prevSegment, prevSegment,
currentSegment.start, currentSegment.start,
prevSegment.endCutoffPlane, prevSegment.endCutoffPlane,
currentSegment.startCutoffPlane, currentSegment.startCutoffPlane,
currentSegment.ULHC, currentSegment.ULHC,
currentSegment.LLHC); currentSegment.LLHC);
// don't need a circle at all. Special constructor... // don't need a circle at all. Special constructor...
endPoints.add(midEndpoint); endPoints.add(midEndpoint);
} else { } else {
endPoints.add( endPoints.add(
new CutoffDualCircleSegmentEndpoint( new CutoffDualCircleSegmentEndpoint(
planetModel, planetModel,
prevSegment, prevSegment,
currentSegment.start, currentSegment.start,
prevSegment.endCutoffPlane, prevSegment.endCutoffPlane,
currentSegment.startCutoffPlane, currentSegment.startCutoffPlane,
prevSegment.URHC, prevSegment.URHC,
prevSegment.LRHC, prevSegment.LRHC,
currentSegment.ULHC, currentSegment.ULHC,
currentSegment.LLHC)); currentSegment.LLHC));
} }
} }
// Do final endpoint // Do final endpoint
final PathSegment lastSegment = segments.get(segments.size() - 1); final PathSegment lastSegment = segments.get(segments.size() - 1);
endPoints.add( endPoints.add(
new CutoffSingleCircleSegmentEndpoint( new CutoffSingleCircleSegmentEndpoint(
planetModel, planetModel,
lastSegment, lastSegment,
lastSegment.end, lastSegment.end,
lastSegment.endCutoffPlane, lastSegment.endCutoffPlane,
lastSegment.URHC, lastSegment.URHC,
lastSegment.LRHC)); lastSegment.LRHC));
} }
final TreeBuilder treeBuilder = new TreeBuilder(segments.size() + endPoints.size()); final TreeBuilder treeBuilder = new TreeBuilder(segments.size() + endPoints.size());
@ -264,7 +266,7 @@ class GeoStandardPath extends GeoBasePath {
rootComponent = treeBuilder.getRoot(); rootComponent = treeBuilder.getRoot();
//System.out.println("Root component: "+rootComponent); // System.out.println("Root component: "+rootComponent);
} }
/** /**
@ -334,7 +336,7 @@ class GeoStandardPath extends GeoBasePath {
protected double distance( protected double distance(
final DistanceStyle distanceStyle, final double x, final double y, final double z) { final DistanceStyle distanceStyle, final double x, final double y, final double z) {
// MHL - need another method in the abstraction! // MHL - need another method in the abstraction!
// Algorithm: // Algorithm:
// (1) If the point is within any of the segments along the path, return that value. // (1) If the point is within any of the segments along the path, return that value.
// (2) If the point is within any of the segment end circles along the path, return that value. // (2) If the point is within any of the segment end circles along the path, return that value.
@ -384,7 +386,8 @@ class GeoStandardPath extends GeoBasePath {
if (rootComponent == null) { if (rootComponent == null) {
return Double.POSITIVE_INFINITY; return Double.POSITIVE_INFINITY;
} }
return distanceStyle.fromAggregationForm(rootComponent.pathDeltaDistance(distanceStyle, x, y, z)); return distanceStyle.fromAggregationForm(
rootComponent.pathDeltaDistance(distanceStyle, x, y, z));
} }
@Override @Override
@ -627,7 +630,8 @@ class GeoStandardPath extends GeoBasePath {
bounds = new XYZBounds(); bounds = new XYZBounds();
child1.getBounds(bounds); child1.getBounds(bounds);
child2.getBounds(bounds); child2.getBounds(bounds);
//System.out.println("Constructed PathNode with child1="+child1+" and child2="+child2+" with computed bounds "+bounds); // System.out.println("Constructed PathNode with child1="+child1+" and child2="+child2+" with
// computed bounds "+bounds);
} }
@Override @Override
@ -640,7 +644,7 @@ class GeoStandardPath extends GeoBasePath {
// We computed the bounds for the node already, so use that as an "early-out". // We computed the bounds for the node already, so use that as an "early-out".
// If we don't leave early, we need to check both children. // If we don't leave early, we need to check both children.
// This code breaks things; not sure why yet. TBD // This code breaks things; not sure why yet. TBD
if (x < bounds.getMinimumX() || x > bounds.getMaximumX()) { if (x < bounds.getMinimumX() || x > bounds.getMaximumX()) {
return false; return false;
} }
@ -743,7 +747,7 @@ class GeoStandardPath extends GeoBasePath {
@Override @Override
public String toString() { public String toString() {
return "PathNode ("+child1+") ("+child2+")"; return "PathNode (" + child1 + ") (" + child2 + ")";
} }
} }
@ -872,7 +876,7 @@ class GeoStandardPath extends GeoBasePath {
@Override @Override
public String toString() { public String toString() {
return "SegmentEndpoint ("+point+")"; return "SegmentEndpoint (" + point + ")";
} }
} }
@ -1718,7 +1722,7 @@ class GeoStandardPath extends GeoBasePath {
@Override @Override
public String toString() { public String toString() {
return "PathSegment ("+ULHC+", "+URHC+", "+LRHC+", "+LLHC+")"; return "PathSegment (" + ULHC + ", " + URHC + ", " + LRHC + ", " + LLHC + ")";
} }
} }