Package org.opentrafficsim.base.geometry
Class FractionalProjectionHelper
java.lang.Object
org.opentrafficsim.base.geometry.FractionalProjectionHelper
Fractional projection helper for
OtsLine2d.
Copyright (c) 2026-2026 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordCache key for directions (normalized angles; nulls allowed).static enumFallback strategies for when fractional projection is not applicable.static final recordValue object: per-segment helper, either center or direction. -
Method Summary
Modifier and TypeMethodDescriptionhelperAtVertex(int vertexIndex, org.djunits.value.vdouble.scalar.Direction start, org.djunits.value.vdouble.scalar.Direction end) Get the helper (center or direction) at a vertex index using (start,end) dependent edges.doubleprojectFractionalAt(org.djunits.value.vdouble.scalar.Direction start, org.djunits.value.vdouble.scalar.Direction end, double x, double y, FractionalProjectionHelper.FractionalFallback fallback) Fractionally project a point on the polyline using the fractional helper logic.
-
Method Details
-
projectFractionalAt
public double projectFractionalAt(org.djunits.value.vdouble.scalar.Direction start, org.djunits.value.vdouble.scalar.Direction end, double x, double y, FractionalProjectionHelper.FractionalFallback fallback) Fractionally project a point on the polyline using the fractional helper logic. Falls back via the given strategy when fractional projection is not applicable.- Parameters:
start- direction in first pointend- direction in last pointx- x-coordinate of point to projecty- y-coordinate of point to projectfallback- fallback method for when fractional projection fails- Returns:
- fractional position along this line of the fractional projection on that line of a point
- See Also:
-
helperAtVertex
public FractionalProjectionHelper.Helper helperAtVertex(int vertexIndex, org.djunits.value.vdouble.scalar.Direction start, org.djunits.value.vdouble.scalar.Direction end) Get the helper (center or direction) at a vertex index using (start,end) dependent edges. Useful for curvature / radius logic. Supply (null,null) if that is the desired configuration.- Parameters:
vertexIndex- 0 .. size-1start- direction at start (can benull)end- direction at end (can benull)- Returns:
- helper
-