use of com.revolsys.geometry.model.Point in project com.revolsys.open by revolsys.
the class RightmostEdgeFinder method getRightmostSideOfSegment.
private int getRightmostSideOfSegment(final DirectedEdge de, final int i) {
final Edge edge = de.getEdge();
if (i < 0 || i + 1 >= edge.getVertexCount()) {
return -1;
}
final Point p1 = edge.getPoint(i);
final Point p2 = edge.getPoint(i + 1);
if (p1.getY() == p2.getY()) {
// indicates edge is parallel to x-axis
return -1;
}
int pos = Position.LEFT;
if (p1.getY() < p2.getY()) {
pos = Position.RIGHT;
}
return pos;
}
use of com.revolsys.geometry.model.Point in project com.revolsys.open by revolsys.
the class RightmostEdgeFinder method checkForRightmostCoordinate.
private void checkForRightmostCoordinate(final DirectedEdge de) {
final Edge edge = de.getEdge();
for (int i = 0; i < edge.getVertexCount() - 1; i++) {
// only check vertices which are the start or end point of a
// non-horizontal segment
// <FIX> MD 19 Sep 03 - NO! we can test all vertices, since the rightmost
// must have a non-horiz segment adjacent to it
final int i1 = i;
final Point point = edge.getPoint(i1);
if (this.minCoord == null || point.getX() > this.minCoord.getX()) {
this.minDe = de;
this.minIndex = i;
this.minCoord = point;
}
// }
}
}
use of com.revolsys.geometry.model.Point in project com.revolsys.open by revolsys.
the class BufferDistanceValidator method checkMaximumDistance.
/**
* Checks that the furthest distance from the buffer curve to the input
* is less than the given maximum distance.
* This uses the Oriented Hausdorff distance metric.
* It corresponds to finding
* the point on the buffer curve which is furthest from <i>some</i> point on the input.
*
* @param input a geometry
* @param bufCurve a geometry
* @param maxDist the maximum distance that a buffer result can be from the input
*/
private void checkMaximumDistance(final Geometry input, final Geometry bufCurve, final double maxDist) {
// BufferCurveMaximumDistanceFinder maxDistFinder = new
// BufferCurveMaximumDistanceFinder(input);
// maxDistanceFound = maxDistFinder.findDistance(bufCurve);
final DiscreteHausdorffDistance haus = new DiscreteHausdorffDistance(bufCurve, input);
haus.setDensifyFraction(0.25);
this.maxDistanceFound = haus.orientedDistance();
if (this.maxDistanceFound > maxDist) {
this.isValid = false;
final Point[] pts = haus.getCoordinates();
this.errorLocation = pts[1];
this.errorIndicator = input.getGeometryFactory().lineString(pts);
this.errMsg = "Distance between buffer curve and input is too large " + "(" + this.maxDistanceFound + " at " + EWktWriter.lineString(pts[0], pts[1]) + ")";
}
}
use of com.revolsys.geometry.model.Point in project com.revolsys.open by revolsys.
the class BufferDistanceValidator method checkMinimumDistance.
/**
* Checks that two geometries are at least a minumum distance apart.
*
* @param g1 a geometry
* @param g2 a geometry
* @param minDist the minimum distance the geometries should be separated by
*/
private void checkMinimumDistance(final Geometry g1, final Geometry g2, final double minDist) {
final DistanceWithPoints distOp = new DistanceWithPoints(g1, g2, minDist);
this.minDistanceFound = distOp.distance();
if (this.minDistanceFound < minDist) {
this.isValid = false;
final List<Point> pts = distOp.nearestPoints();
this.errorLocation = pts.get(1);
this.errorIndicator = g1.getGeometryFactory().lineString(pts);
this.errMsg = "Distance between buffer curve and input is too small " + "(" + this.minDistanceFound + " at " + EWktWriter.lineString(pts.get(0), this.errorLocation) + " )";
}
}
use of com.revolsys.geometry.model.Point in project com.revolsys.open by revolsys.
the class DistanceToPointFinder method computeDistance.
public static void computeDistance(final LineSegment segment, final Point pt, final PointPairDistance ptDist) {
final Point closestPt = segment.closestPoint(pt);
ptDist.setMinimum(closestPt, pt);
}
Aggregations