Package org.djutils.draw.curve
Class Arc2d
java.lang.Object
org.djutils.draw.curve.Arc2d
- All Implemented Interfaces:
Curvature,Curve<DirectedPoint2d,,Double, Point2d, Flattener2d, PolyLine2d> Curve2d,Flattener.FlattableCurve<Point2d,,Double> OffsetCurve2d
Continuous definition of an arc in 2d.
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
-
Constructor Summary
ConstructorsConstructorDescriptionArc2d(DirectedPoint2d startPoint, double radius, boolean left, double angle) Define arc by starting point, radius, curve direction, and angle. -
Method Summary
Modifier and TypeMethodDescriptiondoublegetAngle()Retrieve the total change of direction on this Arc.getDirection(double fraction) Returns the direction at the given fraction.doublegetDirection(double fraction, ContinuousPiecewiseLinearFunction of) Returns the direction at the given fraction.doubleEnd curvature of this Curve2d..doubleEnd radius of this Curve2d.doubleReturn the length of this Curve.getPoint(double fraction) Returns the point at the given fraction of this Curve.getPoint(double fraction, ContinuousPiecewiseLinearFunction of) Returns the point at the given fraction.doubleStart curvature of this Curve2d.doubleStart radius of this Curve2d.booleanisLeft()Does this arc bend to the left?toPolyLine(Flattener2d flattener) Flatten a Curve into a PolyLine.toPolyLine(OffsetFlattener2d flattener, ContinuousPiecewiseLinearFunction offsets) Flatten a Curve2d while offsetting with the provided continuous offset into a PolyLine2d.toString()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.djutils.draw.curve.Curve2d
getEndDirection, getEndPoint, getStartDirection, getStartPointMethods inherited from interface org.djutils.draw.curve.OffsetCurve2d
getT
-
Constructor Details
-
Arc2d
Define arc by starting point, radius, curve direction, and angle.- Parameters:
startPoint- starting pointradius- radius (must be positive)left-truefor left turning curve;falsefor for right turning curveangle- angle of arc (must be positive)
-
-
Method Details
-
getStartCurvature
public double getStartCurvature()Description copied from interface:CurvatureStart curvature of this Curve2d.- Specified by:
getStartCurvaturein interfaceCurvature- Returns:
- start curvature of this Curve2d.
-
getEndCurvature
public double getEndCurvature()Description copied from interface:CurvatureEnd curvature of this Curve2d..- Specified by:
getEndCurvaturein interfaceCurvature- Returns:
- end curvature of this Curve2d
-
getStartRadius
public double getStartRadius()Description copied from interface:CurvatureStart radius of this Curve2d.- Specified by:
getStartRadiusin interfaceCurvature- Returns:
- start radius of this Curve2d
-
getEndRadius
public double getEndRadius()Description copied from interface:CurvatureEnd radius of this Curve2d.- Specified by:
getEndRadiusin interfaceCurvature- Returns:
- end radius of this Curve2d
-
isLeft
public boolean isLeft()Does this arc bend to the left?- Returns:
trueif this Arc bends to the left;falseif this Arc bends to the right
-
getAngle
public double getAngle()Retrieve the total change of direction on this Arc.- Returns:
- the total change of direction on this Arc
-
getPoint
Description copied from interface:CurveReturns the point at the given fraction of this Curve. The fraction may represent any parameter, such as t in a Bézier curve, s in a Clothoid, or simply the fraction of length.- Specified by:
getPointin interfaceCurve<DirectedPoint2d,Double, Point2d, Flattener2d, PolyLine2d> - Specified by:
getPointin interfaceFlattener.FlattableCurve<Point2d,Double> - Parameters:
fraction- the fraction- Returns:
- the point at the given
fraction
-
getPoint
Description copied from interface:OffsetCurve2dReturns 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.- Specified by:
getPointin interfaceOffsetCurve2d- Parameters:
fraction- the fractionof- provides fraction-dependent lateral offset to the point- Returns:
- the point at the given
fraction
-
getDirection
Description copied from interface:CurveReturns 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.- Specified by:
getDirectionin interfaceCurve<DirectedPoint2d,Double, Point2d, Flattener2d, PolyLine2d> - Specified by:
getDirectionin interfaceCurve2d- Specified by:
getDirectionin interfaceFlattener.FlattableCurve<Point2d,Double> - Parameters:
fraction- the fraction- Returns:
- the direction at the given
fraction
-
getDirection
Description copied from interface:OffsetCurve2dReturns 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.- Specified by:
getDirectionin interfaceOffsetCurve2d- Parameters:
fraction- the fractionof- provides fraction-dependent lateral offset to the curve- Returns:
- the direction at the given
fraction
-
toPolyLine
Description copied from interface:CurveFlatten a Curve into a PolyLine. Implementations should use the flattener when relevant and possible.- Specified by:
toPolyLinein interfaceCurve<DirectedPoint2d,Double, Point2d, Flattener2d, PolyLine2d> - Parameters:
flattener- the flattener- Returns:
- approximation of this
Curveas aPolyLine
-
toPolyLine
public PolyLine2d toPolyLine(OffsetFlattener2d flattener, ContinuousPiecewiseLinearFunction offsets) Description copied from interface:OffsetCurve2dFlatten a Curve2d while offsetting with the provided continuous offset into a PolyLine2d. Implementations should use the flattener when relevant and possible.- Specified by:
toPolyLinein interfaceOffsetCurve2d- Parameters:
flattener- OffsetFlatteneroffsets- offset data- Returns:
- approximation of this
curve2dwith offset as aPolyLine2d
-
getLength
public double getLength()Description copied from interface:CurveReturn the length of this Curve.- Specified by:
getLengthin interfaceCurve<DirectedPoint2d,Double, Point2d, Flattener2d, PolyLine2d> - Returns:
- length of this Curve
-
toString
-