Search in sources :

Example 6 with Point

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);
}
Also used : LineString(com.revolsys.geometry.model.LineString) Point(com.revolsys.geometry.model.Point)

Example 7 with Point

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();
}
Also used : Point(com.revolsys.geometry.model.Point) LineStringEditor(com.revolsys.geometry.model.editor.LineStringEditor)

Example 8 with Point

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;
}
Also used : Point(com.revolsys.geometry.model.Point)

Example 9 with Point

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;
    }
}
Also used : Point(com.revolsys.geometry.model.Point)

Example 10 with Point

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);
    }
}
Also used : Point(com.revolsys.geometry.model.Point)

Aggregations

Point (com.revolsys.geometry.model.Point)669 LineString (com.revolsys.geometry.model.LineString)130 GeometryFactory (com.revolsys.geometry.model.GeometryFactory)103 Geometry (com.revolsys.geometry.model.Geometry)95 PointDoubleXY (com.revolsys.geometry.model.impl.PointDoubleXY)90 ArrayList (java.util.ArrayList)79 BoundingBox (com.revolsys.geometry.model.BoundingBox)51 Polygon (com.revolsys.geometry.model.Polygon)42 LineSegment (com.revolsys.geometry.model.segment.LineSegment)34 List (java.util.List)28 LinearRing (com.revolsys.geometry.model.LinearRing)26 PointDouble (com.revolsys.geometry.model.impl.PointDouble)22 PointDoubleXYZ (com.revolsys.geometry.model.impl.PointDoubleXYZ)19 Edge (com.revolsys.geometry.graph.Edge)18 Test (org.junit.Test)17 Punctual (com.revolsys.geometry.model.Punctual)16 Segment (com.revolsys.geometry.model.segment.Segment)15 Vertex (com.revolsys.geometry.model.vertex.Vertex)15 Record (com.revolsys.record.Record)15 Lineal (com.revolsys.geometry.model.Lineal)14