org.onebusaway.geospatial.services
Class GeometryLibrary

java.lang.Object
  extended by org.onebusaway.geospatial.services.GeometryLibrary

public class GeometryLibrary
extends Object


Constructor Summary
GeometryLibrary()
           
 
Method Summary
static
<P extends Point>
double
distance(P a, P b)
           
static
<P extends Point>
double
getAngle(P origin, P a, P b)
           
static double getAngleDifference(double radiansA, double radiansB)
           
static double getRelativeAngleDifference(double from, double to)
           
static boolean inRange(double r1, double r2, double v)
           
static
<P extends Point>
boolean
isBetween(P point, P lineStart, P lineEnd)
          Consider a line segment defined by points 'lineStart' and 'lineEnd'.
static double normalizeAngle(double radians)
          Angle Methods
static
<P extends Point>
P
projectPointToLine(P point, P lineStart, P lineEnd)
           
static
<P extends Point>
P
projectPointToSegment(P point, P segmentStart, P segmentEnd)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GeometryLibrary

public GeometryLibrary()
Method Detail

inRange

public static final boolean inRange(double r1,
                                    double r2,
                                    double v)

normalizeAngle

public static double normalizeAngle(double radians)
Angle Methods


getAngleDifference

public static double getAngleDifference(double radiansA,
                                        double radiansB)

getRelativeAngleDifference

public static double getRelativeAngleDifference(double from,
                                                double to)

distance

public static <P extends Point> double distance(P a,
                                                P b)

getAngle

public static <P extends Point> double getAngle(P origin,
                                                P a,
                                                P b)

projectPointToLine

public static <P extends Point> P projectPointToLine(P point,
                                                     P lineStart,
                                                     P lineEnd)

projectPointToSegment

public static <P extends Point> P projectPointToSegment(P point,
                                                        P segmentStart,
                                                        P segmentEnd)

isBetween

public static <P extends Point> boolean isBetween(P point,
                                                  P lineStart,
                                                  P lineEnd)
Consider a line segment defined by points 'lineStart' and 'lineEnd'. Consider two planes, each perpendicular to the line segment and each intersecting one of the endpoints of the segment. Method returns true when the target 'point' falls on or between these two planes.

Parameters:
point -
lineStart -
lineEnd -
Returns:


Copyright © 2011 OneBusAway. All Rights Reserved.