Package org.geotools.geometry.iso.topograph2D

Examples of org.geotools.geometry.iso.topograph2D.Coordinate


   * absolute value). This has the effect of removing common significant
   * digits from the calculation to maintain more bits of precision.
   */
  private Coordinate intersection(Coordinate p1, Coordinate p2,
      Coordinate q1, Coordinate q2) {
    Coordinate n1 = new Coordinate(p1);
    Coordinate n2 = new Coordinate(p2);
    Coordinate n3 = new Coordinate(q1);
    Coordinate n4 = new Coordinate(q2);
    Coordinate normPt = new Coordinate();
    normalizeToEnvCentre(n1, n2, n3, n4, normPt);

    Coordinate intPt = null;
    try {
      intPt = HCoordinate.intersection(n1, n2, n3, n4);
    } catch (NotRepresentableException e) {
      Assert
          .shouldNeverReachHere("Coordinate for intersection is not calculable");
View Full Code Here


  protected PrecisionModel precisionModel = null;

  // public int numIntersects = 0;

  public LineIntersector() {
    intPt[0] = new Coordinate();
    intPt[1] = new Coordinate();
    // alias the intersection points for ease of reference
    pa = intPt[0];
    pb = intPt[1];
    result = 0;
  }
View Full Code Here

     * in positive x direction.
     */
    int crossings = 0; // number of segment/ray crossings
    for (int i = 1; i < ring.length; i++) {
      int i1 = i - 1;
      Coordinate p1 = ring[i];
      Coordinate p2 = ring[i1];

      if (((p1.y > p.y) && (p2.y <= p.y))
          || ((p2.y > p.y) && (p1.y <= p.y))) {
        double x1 = p1.x - p.x;
        double y1 = p1.y - p.y;
View Full Code Here

   *         interior of a line segment in the linestring
   */
  public static boolean isOnLine(Coordinate p, Coordinate[] pt) {
    LineIntersector lineIntersector = new RobustLineIntersector();
    for (int i = 1; i < pt.length; i++) {
      Coordinate p0 = pt[i - 1];
      Coordinate p1 = pt[i];
      lineIntersector.computeIntersection(p, p0, p1);
      if (lineIntersector.hasIntersection()) {
        return true;
      }
    }
View Full Code Here

  public static boolean isCCW(Coordinate[] ring) {
    // # of points without closing endpoint
    int nPts = ring.length - 1;

    // find highest point
    Coordinate hiPt = ring[0];
    int hiIndex = 0;
    for (int i = 1; i <= nPts; i++) {
      Coordinate p = ring[i];
      if (p.y > hiPt.y) {
        hiPt = p;
        hiIndex = i;
      }
    }

    // find distinct point before highest point
    int iPrev = hiIndex;
    do {
      iPrev = iPrev - 1;
      if (iPrev < 0)
        iPrev = nPts;
    } while (ring[iPrev].equals2D(hiPt) && iPrev != hiIndex);

    // find distinct point after highest point
    int iNext = hiIndex;
    do {
      iNext = (iNext + 1) % nPts;
    } while (ring[iNext].equals2D(hiPt) && iNext != hiIndex);

    Coordinate prev = ring[iPrev];
    Coordinate next = ring[iNext];

    /**
     * This check catches cases where the ring contains an A-B-A
     * configuration of points. This can happen if the ring does not contain
     * 3 distinct points (including the case where the input array has fewer
     * than 4 elements), or it contains coincident line segments.
     */
    if (prev.equals2D(hiPt) || next.equals2D(hiPt) || prev.equals2D(next))
      return false;

    int disc = computeOrientation(prev, hiPt, next);

    /**
 
View Full Code Here

    // Filter all coordinates to eleminate redudant coordinates
    Iterator posIter = positions.iterator();
    while (posIter.hasNext()) {
      Object pos = posIter.next();
      if (pos instanceof DirectPositionImpl) {
        filter.filter(new Coordinate(((DirectPositionImpl)pos).getCoordinate()));
      } else if (pos instanceof PointImpl) {
        filter.filter(new Coordinate(((PointImpl)pos).getPosition().getCoordinate()));
      } else
        Assert.isTrue(false, "Invalid coordinate type");
    }
   
    return filter.getCoordinates();
View Full Code Here

   * of Java.
   */
  protected Coordinate[] toCoordinateArray(Stack stack) {
    Coordinate[] coordinates = new Coordinate[stack.size()];
    for (int i = 0; i < stack.size(); i++) {
      Coordinate coordinate = (Coordinate) stack.get(i);
      coordinates[i] = coordinate;
    }
    return coordinates;
  }
View Full Code Here

        .toCoordinateArray(reducedSet);
    return reducedPts;
  }

  private Coordinate[] preSort(Coordinate[] pts) {
    Coordinate t;

    // find the lowest point in the set. If two or more points have
    // the same minimum y coordinate choose the one with the minimu x.
    // This focal point is put in array location pts[0].
    for (int i = 1; i < pts.length; i++) {
View Full Code Here

    // radialSort(pts);
    return pts;
  }

  private Stack grahamScan(Coordinate[] c) {
    Coordinate p;
    Stack ps = new Stack();
    p = (Coordinate) ps.push(c[0]);
    p = (Coordinate) ps.push(c[1]);
    p = (Coordinate) ps.push(c[2]);
    for (int i = 3; i < c.length; i++) {
View Full Code Here

   * @return the coordinates with unnecessary (collinear) vertices removed
   */
  private Coordinate[] cleanRing(Coordinate[] original) {
    Assert.equals(original[0], original[original.length - 1]);
    ArrayList cleanedRing = new ArrayList();
    Coordinate previousDistinctCoordinate = null;
    for (int i = 0; i <= original.length - 2; i++) {
      Coordinate currentCoordinate = original[i];
      Coordinate nextCoordinate = original[i + 1];
      if (currentCoordinate.equals(nextCoordinate)) {
        continue;
      }
      if (previousDistinctCoordinate != null
          && isBetween(previousDistinctCoordinate, currentCoordinate,
View Full Code Here

TOP

Related Classes of org.geotools.geometry.iso.topograph2D.Coordinate

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.