use of com.revolsys.geometry.operation.distance.FacetSequence in project com.revolsys.open by revolsys.
the class MinimumClearance method compute.
private void compute() {
if (!this.calculated) {
this.calculated = true;
this.minClearance = Double.MAX_VALUE;
if (!this.geometry.isEmpty()) {
final StrTree<FacetSequence> geomTree = FacetSequenceTreeBuilder.build(this.geometry);
final Pair<FacetSequence, FacetSequence> nearest = geomTree.nearestNeighbour(new MinClearanceDistance(this.calculateLine));
final MinClearanceDistance mcd = new MinClearanceDistance(this.calculateLine);
this.minClearance = mcd.distance(nearest.getValue1(), nearest.getValue2());
final GeometryFactory geometryFactory = this.geometry.getGeometryFactory();
if (this.calculateLine) {
this.minClearancePts = new Point[] { //
geometryFactory.point(mcd.getMinX1(), mcd.getMinY1()), geometryFactory.point(mcd.getMinX2(), mcd.getMinY2()) };
}
}
}
}
Aggregations