Package org.djutils.draw.curve
Interface OffsetCurve2d
- All Superinterfaces:
Curve<DirectedPoint2d,
,Double, Point2d, Flattener2d, PolyLine2d> Curve2d
,Flattener.FlattableCurve<Point2d,
Double>
- All Known Implementing Classes:
Arc2d
,BezierCubic2d
,Clothoid2d
,Straight2d
OffsetCurve2d.java.
Copyright (c) 2024-2025 Delft University of Technology, Jaffalaan 5, 2628 BX Delft, the Netherlands. All rights reserved. See for project information https://djutils.org. The DJUTILS project is distributed under a three-clause BSD-style license, which can be found at https://djutils.org/docs/license.html.
- Author:
- Alexander Verbraeck
-
Method Summary
Modifier and TypeMethodDescriptiondefault double
getDirection
(double fraction, ContinuousPiecewiseLinearFunction of) Returns the direction at the given fraction.getPoint
(double fraction, ContinuousPiecewiseLinearFunction of) Returns the point at the given fraction.default double
getT
(double position) Convert a position along the curve to a t-value in theOffsetCurve2d
domain.toPolyLine
(OffsetFlattener2d flattener, ContinuousPiecewiseLinearFunction offsets) Flatten a Curve2d while offsetting with the provided continuous offset into a PolyLine2d.Methods inherited from interface org.djutils.draw.curve.Curve
getKnots, getLength, getPoint, toPolyLine
Methods inherited from interface org.djutils.draw.curve.Curve2d
getDirection, getEndDirection, getEndPoint, getStartDirection, getStartPoint
Methods inherited from interface org.djutils.draw.curve.Flattener.FlattableCurve
getPoint
-
Method Details
-
toPolyLine
Flatten a Curve2d while offsetting with the provided continuous offset into a PolyLine2d. Implementations should use the flattener when relevant and possible.- Parameters:
flattener
- OffsetFlatteneroffsets
- offset data- Returns:
- approximation of this
curve2d
with offset as aPolyLine2d
- Throws:
NullPointerException
- whenflattener
, oroffsets
isnull
-
getPoint
Returns the point at the given fraction. The fraction may represent any parameter, such as t in a Bézier curve, s in a Clothoid, or simply the fraction of length.- Parameters:
fraction
- the fractionof
- provides fraction-dependent lateral offset to the point- Returns:
- the point at the given
fraction
-
getDirection
Returns the direction at the given fraction. The fraction may represent any parameter, such as t in a Bézier curve, s in a Clothoid, or simply the fraction of length. The default implementation performs a numerical approach by looking at the direction between the points at fraction, and a point 1e-6 away.- Parameters:
fraction
- the fractionof
- provides fraction-dependent lateral offset to the curve- Returns:
- the direction at the given
fraction
-
getT
default double getT(double position) Convert a position along the curve to a t-value in theOffsetCurve2d
domain. ForArc
andStraight
, these t-values are the same. ForBezierCubic
they're not.- Parameters:
position
- t-value in theContinuousPiecewiseLinearFunction
domain- Returns:
- t-value in the
ContinuousPiecewiseLinearFunction
domain
-