Package org.onebusaway.geospatial.model

Examples of org.onebusaway.geospatial.model.PointVector


  public static <P extends Point> double distance(P a, P b) {
    return a.getDistance(b);
  }

  public static <P extends Point> double getAngle(P origin, P a, P b) {
    PointVector va = PointVector.create(origin, a);
    PointVector vb = PointVector.create(origin, b);
    return va.getAngle(vb);
  }
View Full Code Here


    return va.getAngle(vb);
  }

  public static <P extends Point> P projectPointToLine(P point, P lineStart,
      P lineEnd) {
    PointVector v = PointVector.create(lineStart, point);
    PointVector line = PointVector.create(lineStart, lineEnd);
    return line.getProjection(v).addToPoint(lineStart);
  }
View Full Code Here

    return line.getProjection(v).addToPoint(lineStart);
  }

  public static <P extends Point> P projectPointToSegment(P point,
      P segmentStart, P segmentEnd) {
    PointVector v = PointVector.create(segmentStart, point);
    PointVector line = PointVector.create(segmentStart, segmentEnd);
    P p = line.getProjection(v).addToPoint(segmentStart);
    if (isBetween(p, segmentStart, segmentEnd))
      return p;
    double a = p.getDistance(segmentStart);
    double b = p.getDistance(segmentEnd);
    return a <= b ? segmentStart : segmentEnd;
View Full Code Here

TOP

Related Classes of org.onebusaway.geospatial.model.PointVector

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.