Package org.opentrafficsim.core.geometry
Class ContinuousBezierCubic
java.lang.Object
org.opentrafficsim.core.geometry.ContinuousBezier
org.opentrafficsim.core.geometry.ContinuousBezierCubic
- All Implemented Interfaces:
ContinuousLine
Continuous definition of a cubic Bezier. This extends from the more general
ContinuousBezier as certain methods are
applied to calculate e.g. the roots, that are specific to cubic Beziers. With such information this class can also specify
information to be a ContinuousLine.
Copyright (c) 2023-2024 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.
- Author:
- Wouter Schakel
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.opentrafficsim.core.geometry.ContinuousLine
ContinuousLine.ContinuousDoubleFunction -
Field Summary
Fields inherited from class org.opentrafficsim.core.geometry.ContinuousBezier
points -
Constructor Summary
ConstructorsConstructorDescriptionContinuousBezierCubic(org.djutils.draw.point.Point2d point1, org.djutils.draw.point.Point2d point2, org.djutils.draw.point.Point2d point3, org.djutils.draw.point.Point2d point4) Create a cubic Bezier. -
Method Summary
Modifier and TypeMethodDescriptionorg.djutils.draw.line.PolyLine2dFlatten continuous line in to a polyline.org.djutils.draw.line.PolyLine2dflattenOffset(ContinuousLine.ContinuousDoubleFunction offset, Flattener flattener) Flatten continuous line offset in to a polyline.doubleEnd curvature.org.djutils.draw.point.OrientedPoint2dEnd point.doubleReturn the length of the line.doubleStart curvature.org.djutils.draw.point.OrientedPoint2dStart point.doublegetT(double len) Returns the t value at the provided length along the Bezier.split(double t) Splits the Bezier in two Beziers of the same order.toString()Methods inherited from class org.opentrafficsim.core.geometry.ContinuousBezier
at, curvature, derivative, lengthMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.opentrafficsim.core.geometry.ContinuousLine
getEndDirection, getEndRadius, getStartDirection, getStartRadius
-
Constructor Details
-
ContinuousBezierCubic
public ContinuousBezierCubic(org.djutils.draw.point.Point2d point1, org.djutils.draw.point.Point2d point2, org.djutils.draw.point.Point2d point3, org.djutils.draw.point.Point2d point4) Create a cubic Bezier.- Parameters:
point1- start point.point2- first intermediate shape point.point3- second intermediate shape point.point4- end point.
-
-
Method Details
-
getStartPoint
public org.djutils.draw.point.OrientedPoint2d getStartPoint()Description copied from interface:ContinuousLineStart point.- Specified by:
getStartPointin interfaceContinuousLine- Returns:
- start point
-
getEndPoint
public org.djutils.draw.point.OrientedPoint2d getEndPoint()Description copied from interface:ContinuousLineEnd point.- Specified by:
getEndPointin interfaceContinuousLine- Returns:
- end point
-
getStartCurvature
public double getStartCurvature()Description copied from interface:ContinuousLineStart curvature.- Specified by:
getStartCurvaturein interfaceContinuousLine- Returns:
- start curvature
-
getEndCurvature
public double getEndCurvature()Description copied from interface:ContinuousLineEnd curvature.- Specified by:
getEndCurvaturein interfaceContinuousLine- Returns:
- end curvature
-
getT
public double getT(double len) Returns the t value at the provided length along the Bezier. This method uses an iterative approach with a precision of 1e-6.- Parameters:
len- length along the Bezier.- Returns:
- t value at the provided length along the Bezier.
-
split
Splits the Bezier in two Beziers of the same order.- Parameters:
t- t value along the Bezier to apply the split.- Returns:
- the Bezier before t, and the Bezier after t.
-
flatten
Description copied from interface:ContinuousLineFlatten continuous line in to a polyline. Implementations should use the flattener when relevant and possible.- Specified by:
flattenin interfaceContinuousLine- Parameters:
flattener- flattener- Returns:
- flattened line
-
flattenOffset
public org.djutils.draw.line.PolyLine2d flattenOffset(ContinuousLine.ContinuousDoubleFunction offset, Flattener flattener) Description copied from interface:ContinuousLineFlatten continuous line offset in to a polyline. Implementations should use the flattener when relevant and possible.- Specified by:
flattenOffsetin interfaceContinuousLine- Parameters:
offset- offset dataflattener- flattener- Returns:
- flattened line
-
getLength
public double getLength()Description copied from interface:ContinuousLineReturn the length of the line.- Specified by:
getLengthin interfaceContinuousLine- Returns:
- length of the line
-
toString
- Overrides:
toStringin classContinuousBezier
-