Search in sources :

Example 1 with PointList

use of com.revolsys.geometry.model.PointList in project com.revolsys.open by revolsys.

the class ConvexHull method computeOctRing.

private static List<Point> computeOctRing(final Collection<Point> points) {
    final PointList pointList = computeOctPts(points);
    // points must all lie in a line
    if (pointList.size() < 3) {
        return null;
    }
    pointList.closeRing();
    return pointList;
}
Also used : PointList(com.revolsys.geometry.model.PointList)

Example 2 with PointList

use of com.revolsys.geometry.model.PointList in project com.revolsys.open by revolsys.

the class QuadEdgeConformingDelaunayTinBuilder method unique.

public static PointList unique(final Iterable<? extends Point> points, final int vertexCount) {
    final Point[] pointArray = new Point[vertexCount];
    int vertexIndex = 0;
    for (final Point point : points) {
        pointArray[vertexIndex++] = point.newPoint();
    }
    Arrays.sort(pointArray);
    final PointList coordList = new PointList(pointArray, false);
    return coordList;
}
Also used : PointList(com.revolsys.geometry.model.PointList) Point(com.revolsys.geometry.model.Point) Point(com.revolsys.geometry.model.Point)

Example 3 with PointList

use of com.revolsys.geometry.model.PointList in project com.revolsys.open by revolsys.

the class LineDissolver method buildRing.

private void buildRing(final HalfEdge eStartRing) {
    final PointList line = new PointList();
    HalfEdge e = eStartRing;
    line.add(e.orig().newPoint(), false);
    // scan along the path until a node is found (if one exists)
    while (e.sym().degree() == 2) {
        final HalfEdge eNext = e.next();
        // check if edges form a ring - if so, we're done
        if (eNext == eStartRing) {
            break;
        }
        // add point to line, and move to next edge
        line.add(eNext.orig().newPoint(), false);
        e = eNext;
    }
    // add final node
    line.add(e.dest().newPoint(), false);
    // store the scanned line
    addLine(line);
}
Also used : PointList(com.revolsys.geometry.model.PointList) HalfEdge(com.revolsys.geometry.edgegraph.HalfEdge) MarkHalfEdge(com.revolsys.geometry.edgegraph.MarkHalfEdge)

Example 4 with PointList

use of com.revolsys.geometry.model.PointList in project com.revolsys.open by revolsys.

the class LineDissolver method buildLine.

/**
 * Builds a line starting from the given edge.
 * The start edge origin is a node (valence = 1 or >= 3),
 * unless it is part of a pure ring.
 * A pure ring has no other incident lines.
 * In this case the start edge may occur anywhere on the ring.
 *
 * The line is built up to the next node encountered,
 * or until the start edge is re-encountered
 * (which happens if the edges form a ring).
 *
 * @param eStart
 */
private void buildLine(final HalfEdge eStart) {
    final PointList line = new PointList();
    DissolveHalfEdge e = (DissolveHalfEdge) eStart;
    this.ringStartEdge = null;
    MarkHalfEdge.markBoth(e);
    line.add(e.orig().newPoint(), false);
    // scan along the path until a node is found (if one exists)
    while (e.sym().degree() == 2) {
        updateRingStartEdge(e);
        final DissolveHalfEdge eNext = (DissolveHalfEdge) e.next();
        // check if edges form a ring - if so, we're done
        if (eNext == eStart) {
            buildRing(this.ringStartEdge);
            return;
        }
        // add point to line, and move to next edge
        line.add(eNext.orig().newPoint(), false);
        e = eNext;
        MarkHalfEdge.markBoth(e);
    }
    // add final node
    line.add(e.dest().newPoint(), false);
    // queue up the final node edges
    stackEdges(e.sym());
    // store the scanned line
    addLine(line);
}
Also used : PointList(com.revolsys.geometry.model.PointList)

Example 5 with PointList

use of com.revolsys.geometry.model.PointList in project com.revolsys.open by revolsys.

the class EdgeRing method getCoordinates.

/**
 * Computes the list of coordinates which are contained in this ring.
 * The coordinatea are computed once only and cached.
 *
 * @return an array of the {@link Coordinates}s in this ring
 */
private Point[] getCoordinates() {
    if (this.ringPts == null) {
        final PointList coordList = new PointList();
        for (final DirectedEdge de : this.deList) {
            final PolygonizeEdge edge = (PolygonizeEdge) de.getEdge();
            addEdge(edge.getLine(), de.getEdgeDirection(), coordList);
        }
        this.ringPts = coordList.toPointArray();
    }
    return this.ringPts;
}
Also used : PointList(com.revolsys.geometry.model.PointList) DirectedEdge(com.revolsys.geometry.planargraph.DirectedEdge)

Aggregations

PointList (com.revolsys.geometry.model.PointList)11 Point (com.revolsys.geometry.model.Point)6 LineString (com.revolsys.geometry.model.LineString)3 GeometryFactory (com.revolsys.geometry.model.GeometryFactory)2 PointDoubleXY (com.revolsys.geometry.model.impl.PointDoubleXY)2 GeometricShapeFactory (com.revolsys.geometry.util.GeometricShapeFactory)2 HalfEdge (com.revolsys.geometry.edgegraph.HalfEdge)1 MarkHalfEdge (com.revolsys.geometry.edgegraph.MarkHalfEdge)1 DirectedEdge (com.revolsys.geometry.planargraph.DirectedEdge)1