use of com.revolsys.geometry.model.Point in project com.revolsys.open by revolsys.
the class DistanceWithLocation method computePointsPoints.
private boolean computePointsPoints(final List<Point> points1, final List<Point> points2) {
for (final Point point1 : points1) {
for (final Point point2 : points2) {
final double dist = point1.distancePoint(point2);
if (dist < this.minDistance) {
this.minDistance = dist;
this.minDistanceLocation1 = new GeometryLocation(point1, 0, point1);
this.minDistanceLocation2 = new GeometryLocation(point2, 0, point2);
if (this.minDistance <= this.terminateDistance) {
return true;
}
}
}
}
return false;
}
use of com.revolsys.geometry.model.Point in project com.revolsys.open by revolsys.
the class DistanceWithLocation method nearestPoints.
/**
* Report the coordinates of the nearest points in the input geometries.
* The points are presented in the same order as the input Geometries.
*
* @return a pair of {@link Coordinates}s of the nearest points
*/
public List<Point> nearestPoints() {
distance();
if (this.minDistanceLocation1 == null) {
return Collections.emptyList();
} else {
final Point point1 = this.minDistanceLocation1.getPoint();
final Point point2 = this.minDistanceLocation2.getPoint();
return Arrays.asList(point1, point2);
}
}
use of com.revolsys.geometry.model.Point in project com.revolsys.open by revolsys.
the class DistanceWithLocation method computeLinePoint.
private boolean computeLinePoint(final LineString line, final Point point) {
if (this.minDistance == Double.MAX_VALUE || line.getBoundingBox().distance(point) <= this.minDistance) {
for (final Segment segment : line.segments()) {
final double distance = segment.distancePoint(point);
if (distance < this.minDistance) {
this.minDistance = distance;
final Point closestPoint = segment.closestPoint(point);
final int segmentIndex = segment.getSegmentIndex();
this.minDistanceLocation1 = new GeometryLocation(line, segmentIndex, closestPoint);
this.minDistanceLocation2 = new GeometryLocation(point, 0, point);
if (this.minDistance <= this.terminateDistance) {
return true;
}
}
}
}
return false;
}
use of com.revolsys.geometry.model.Point in project com.revolsys.open by revolsys.
the class MCIndexSnapRounder method computeVertexSnaps.
/**
* Snaps segments to the vertices of a Segment String.
*/
private void computeVertexSnaps(final NodedSegmentString segment) {
final LineString points = segment.getLineString();
for (int i = 0; i < points.getVertexCount(); i++) {
final Point point = points.getPoint(i);
final HotPixel hotPixel = new HotPixel(point, this.scaleFactor, this.li);
final boolean isNodeAdded = this.pointSnapper.snap(hotPixel, segment, i);
// if a node is created for a vertex, that vertex must be noded too
if (isNodeAdded) {
segment.addIntersection(point, i);
}
}
}
use of com.revolsys.geometry.model.Point in project com.revolsys.open by revolsys.
the class MCIndexSnapRounder method computeIntersectionSnaps.
/**
* Snaps segments to nodes created by segment intersections.
*/
private void computeIntersectionSnaps(final Collection<Point> snapPts) {
for (final Point snapPt : snapPts) {
final HotPixel hotPixel = new HotPixel(snapPt, this.scaleFactor, this.li);
this.pointSnapper.snap(hotPixel);
}
}
Aggregations