public class ShapePointsLibrary
- extends Object
|Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public ShapePointsLibrary(double localMinimumThreshold)
public void setLocalMinimumThreshold(double localMinimumThreshold)
- When searching for the closest point along a block's shape, there may be
multiple local minimums as a block potentially loops back on itself. This
threshold (in meters) determines how close a local minimum should be if it
is to be considered.
public List<XYPoint> getProjectedShapePoints(ShapePoints shapePoints,
public List<PointAndIndex> computePotentialAssignments(List<XYPoint> projectedShapePoints,
- Here is the idea:
Given a shape as an array of XY Points, a range over those points, and a
target point, find the closest location(s) along the shape for the target
The trick is that there may be multiple good assignments, especially for a
shape that loops back on itself. In this case, we look for assignments
_localMinimumThreshold distance. There will typically
be ranges of assignments that apply and we take the local min within each
range. We then return each of these local mins as a potential assignment.
There is an additional wrinkle when the section of the shape that loops
back occurs where all the shape points are within
_localMinimumThreshold of the target point. In this case, we no
longer consider the local min for the section, but the individual local
mins within the section. That is to say, if we find a local min and then
the shape moves away and comes back, we'll consider the second local min as
a new potential assignment.
If no assignments are found within the
distance, we just return the global min.
Copyright © 2011 OneBusAway. All Rights Reserved.