Package org.djutils.draw.curve
Interface OffsetFlattener2d
- All Superinterfaces:
Flattener<Flattener2d,
Curve2d, PolyLine2d, Point2d, Double>
- All Known Implementing Classes:
OffsetFlattener2d.MaxAngle
,OffsetFlattener2d.MaxDeviation
,OffsetFlattener2d.MaxDeviationAndAngle
,OffsetFlattener2d.NumSegments
Flattens a Curve2d with piece-wise linear offset in to a PolyLine2d.
Copyright (c) 2023-2025 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.
- Author:
- Alexander Verbraeck, Peter Knoppers, Wouter Schakel
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic class
OffsetFlattener that limits the angle difference between theOffsetCurve2d
and thePolyLine2d
.static class
Flattener that limits the distance between theOffsetCurvee2d
and thePolyLine2d
.static class
OffsetFlattener that limits distance and angle difference between theOffsetCurve2d
and thePolyLine2d
.static class
Flattener that approximates theOffsetCurve2d
with a specified number of segments.Nested classes/interfaces inherited from interface org.djutils.draw.curve.Flattener
Flattener.FlattableCurve<P,
DIR> -
Method Summary
Modifier and TypeMethodDescriptiondefault boolean
checkDirectionError
(Double segmentDirection, Double curveDirectionAtStart, Double curveDirectionAtEnd, double maxDirectionDeviation) Check direction difference at the start and end of a segment.default boolean
checkLoopBack
(Double prevDirection, Double nextDirection) Check for a direction change of more than 90 degrees.Flatten a OffsetCurve2d curve into a PolyLine2d while applying lateral offsets.default void
loadKnot
(NavigableMap<Double, Point2d> map, double knot, OffsetCurve2d curve, ContinuousPiecewiseLinearFunction of) Load one knot in the map of fractions and points.default void
loadKnots
(NavigableMap<Double, Point2d> map, OffsetCurve2d curve, ContinuousPiecewiseLinearFunction of) Load the knots into the navigable map (including the start point and the end point).default Flattener.FlattableCurve<Point2d,
Double> Make a FlattableCurve object.Methods inherited from interface org.djutils.draw.curve.Flattener
checkInflectionPoint, checkPositionError, loadKnot, loadKnots
-
Method Details
-
flatten
Flatten a OffsetCurve2d curve into a PolyLine2d while applying lateral offsets.- Parameters:
curve
- the curveof
- the lateral offset to apply- Returns:
- flattened curve
-
checkLoopBack
Description copied from interface:Flattener
Check for a direction change of more than 90 degrees. If that happens, the MaxDeviation flattener must zoom in closer.- Specified by:
checkLoopBack
in interfaceFlattener<Flattener2d,
Curve2d, PolyLine2d, Point2d, Double> - Parameters:
prevDirection
- the direction at the preceding (already added) pointnextDirection
- the direction at the succeeding (already added) point- Returns:
true
if the curve changes direction by more than 90 degrees;false
if the curve does not change direction by more than 90 degrees
-
checkDirectionError
default boolean checkDirectionError(Double segmentDirection, Double curveDirectionAtStart, Double curveDirectionAtEnd, double maxDirectionDeviation) Description copied from interface:Flattener
Check direction difference at the start and end of a segment.- Specified by:
checkDirectionError
in interfaceFlattener<Flattener2d,
Curve2d, PolyLine2d, Point2d, Double> - Parameters:
segmentDirection
- direction of the segmentcurveDirectionAtStart
- direction of the curve at the start of the segmentcurveDirectionAtEnd
- direction of the curve at the end of the segmentmaxDirectionDeviation
- maximum permitted direction difference- Returns:
true
if the direction difference at the start and the end of the segment is smaller thanmaxDirectionDeviation
;false
if the direction difference at the start, or the end of the segment equals or exceedsmaxDirectionDeviation
-
makeFlattableCurve
default Flattener.FlattableCurve<Point2d,Double> makeFlattableCurve(OffsetCurve2d curve, ContinuousPiecewiseLinearFunction of) Make a FlattableCurve object.- Parameters:
curve
- the curveof
- the offset function- Returns:
- the flattable curve
-