use of com.revolsys.geometry.model.Point in project com.revolsys.open by revolsys.
the class QuadEdgeSubdivision method getEdgesLineal.
/**
* Gets the geometry for the edges in the subdivision as a {@link Lineal}
* containing 2-point lines.
*
* @param geometryFactory the GeometryFactory to use
* @return a MultiLineString
*/
public Lineal getEdgesLineal(final GeometryFactory geometryFactory) {
final List<QuadEdge> quadEdges = getPrimaryEdges(false);
final LineString[] lines = new LineString[quadEdges.size()];
int i = 0;
for (final QuadEdge edge : quadEdges) {
lines[i++] = edge.newLineString(geometryFactory);
}
return geometryFactory.lineal(lines);
}
use of com.revolsys.geometry.model.Point in project com.revolsys.open by revolsys.
the class QuadEdgeSubdivision method getBoundary.
public Geometry getBoundary() {
final LineStringEditor lineBuilder = new LineStringEditor(this.geometryFactory);
for (final QuadEdge startingEdge : Arrays.asList(this.edge1, this.edge3, this.edge2)) {
QuadEdge edge = startingEdge;
do {
final Point toPoint = edge.getToPoint();
final double toX = toPoint.getX();
final double toY = toPoint.getY();
if (isFrameCoordinate(toX, toY)) {
} else {
lineBuilder.appendVertex(toPoint, false);
}
edge = edge.getFromNextEdge();
} while (edge != startingEdge);
}
return lineBuilder.newBestGeometry();
}
use of com.revolsys.geometry.model.Point in project com.revolsys.open by revolsys.
the class QuadEdgeSubdivision method connectEdges.
/**
* Creates a new QuadEdge connecting the destination of edge1 to the origin of
* edge2, in such a way that all three have the same left face after the
* connection is complete. Additionally, the data pointers of the new edge
* are set.
*
* @return the connected edge.
*/
private QuadEdge connectEdges(QuadEdge edge, final QuadEdge startEdge) {
QuadEdge base = startEdge;
QuadEdge leftNext = edge.getLeftNext();
do {
final QuadEdge edge2 = base.sym();
final Point toPoint1 = edge.getToPoint();
final Point fromPoint2 = edge2.getFromPoint();
this.edgeCount++;
base = new QuadEdge(toPoint1, fromPoint2);
base.splice(leftNext);
base.sym().splice(edge2);
edge = base.oPrev();
this.triangleCount++;
leftNext = edge.getLeftNext();
} while (leftNext != startEdge);
return edge;
}
use of com.revolsys.geometry.model.Point in project com.revolsys.open by revolsys.
the class QuadEdgeSubdivision method insertVertices.
/**
* Insert all the vertices into the triangulation. The vertices must have the same
* {@link GeometryFactory} as the this and therefore precision model.
*
* @param vertices The point vertices to add.
*
* @throws LocateFailureException if the location algorithm fails to converge in a reasonable number of iterations
*/
public void insertVertices(final Iterable<? extends Point> vertices) throws LocateFailureException {
double lastX = Double.NaN;
double lastY = Double.NaN;
for (final Point vertex : vertices) {
final double x = vertex.getX();
final double y = vertex.getY();
if (x != lastX || y != lastY) {
insertVertex(vertex);
}
lastX = x;
lastY = y;
}
}
use of com.revolsys.geometry.model.Point in project com.revolsys.open by revolsys.
the class ConformingDelaunayTriangulator method insertSites.
/**
* Inserts all sites in a collection
*
* @param vertices a collection of ConstraintVertex
*/
private void insertSites(final Iterable<? extends Point> vertices) {
for (final Point point : vertices) {
final ConstraintVertex vertex = (ConstraintVertex) point;
insertSite(vertex);
}
}
Aggregations