org.opentripplanner.ext.traveltime.geometry.ZMetric Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of otp Show documentation
Show all versions of otp Show documentation
The OpenTripPlanner multimodal journey planning system
package org.opentripplanner.ext.traveltime.geometry;
/**
* A ZMetric is a metric for some generic TZ value.
*
* By metric here we understand:
*
* - Cutting detection on a range, z0 in [Za, Zb] (rely on TZ to be an ordered set)
* - Interpolation on a range, z0 in [Za, Zb].
*
* Cutting detection could be easily implemented using interpolation, but usually interpolating
* is rather more expansive than cutting detection, so we split the two operations.
*
* @author laurent
*/
public interface ZMetric {
/**
* Check if the edge [AB] between two samples A and B "intersect" the zz0 plane.
*
* @param zA z value for the A sample
* @param zB z value for the B sample
* @param z0 z value for the intersecting plane
* @return 0 if no intersection, -1 or +1 if intersection (depending on which is lower, A or B).
*/
int cut(TZ zA, TZ zB, TZ z0);
/**
* Interpolate a crossing point on an edge [AB].
*
* @param zA z value for the A sample
* @param zB z value for the B sample
* @param z0 z value for the intersecting plane
* @return k value between 0 and 1, where the crossing occurs. 0=A, 1=B.
*/
double interpolate(TZ zA, TZ zB, TZ z0);
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy