Package org.opentrafficsim.core.geometry
Record Class CurveFlattener
java.lang.Object
java.lang.Record
org.opentrafficsim.core.geometry.CurveFlattener
- Record Components:
flattener- regular flatteneroffsetFlattener- offset flattener
- All Implemented Interfaces:
Flattener<Flattener2d,,Curve2d, PolyLine2d, Point2d, Double> Flattener2d,OffsetFlattener2d
public record CurveFlattener(Flattener2d flattener, OffsetFlattener2d offsetFlattener)
extends Record
implements Flattener2d, OffsetFlattener2d
Record combining a
Flattener2d and OffsetFlattener2d.
Copyright (c) 2024-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
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.djutils.draw.curve.Flattener
Flattener.FlattableCurve<P extends Object,DIR extends Object> Nested classes/interfaces inherited from interface org.djutils.draw.curve.Flattener2d
Flattener2d.MaxAngle, Flattener2d.MaxDeviation, Flattener2d.MaxDeviationAndAngle, Flattener2d.NumSegmentsNested classes/interfaces inherited from interface org.djutils.draw.curve.OffsetFlattener2d
OffsetFlattener2d.MaxAngle, OffsetFlattener2d.MaxDeviation, OffsetFlattener2d.MaxDeviationAndAngle, OffsetFlattener2d.NumSegments -
Constructor Summary
ConstructorsConstructorDescriptionCurveFlattener(double maxDeviation) Flattener based on maximum deviation.CurveFlattener(double maxDeviation, double maxAngle) Flattener based on maximum deviation and angle.CurveFlattener(int numSegments) Flattener based on number of segments.CurveFlattener(Angle maxAngle) Flattener based on maximum angle.CurveFlattener(Flattener2d flattener, OffsetFlattener2d offsetFlattener) Creates an instance of aCurveFlattenerrecord class. -
Method Summary
Modifier and TypeMethodDescriptionbooleancheckDirectionError(Double segmentDirection, Double curveDirectionAtStart, Double curveDirectionAtEnd, double maxDirectionDeviation) booleancheckLoopBack(Double prevDirection, Double nextDirection) final booleanIndicates whether some other object is "equal to" this one.Returns the value of theflattenerrecord component.final inthashCode()Returns a hash code value for this object.Returns the value of theoffsetFlattenerrecord component.final StringtoString()Returns a string representation of this record class.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.djutils.draw.curve.Flattener
checkInflectionPoint, checkPositionError, loadKnot, loadKnotsMethods inherited from interface org.djutils.draw.curve.OffsetFlattener2d
loadKnot, loadKnots, makeFlattableCurve
-
Constructor Details
-
CurveFlattener
public CurveFlattener(int numSegments) Flattener based on number of segments.- Parameters:
numSegments- number of segments
-
CurveFlattener
public CurveFlattener(double maxDeviation) Flattener based on maximum deviation.- Parameters:
maxDeviation- maximum deviation
-
CurveFlattener
Flattener based on maximum angle.- Parameters:
maxAngle- maximum angle
-
CurveFlattener
public CurveFlattener(double maxDeviation, double maxAngle) Flattener based on maximum deviation and angle.- Parameters:
maxDeviation- maximum deviationmaxAngle- maximum angle
-
CurveFlattener
Creates an instance of aCurveFlattenerrecord class.- Parameters:
flattener- the value for theflattenerrecord componentoffsetFlattener- the value for theoffsetFlattenerrecord component
-
-
Method Details
-
flatten
- Specified by:
flattenin interfaceFlattener2d
-
flatten
- Specified by:
flattenin interfaceOffsetFlattener2d
-
checkLoopBack
- Specified by:
checkLoopBackin interfaceFlattener<Flattener2d,Curve2d, PolyLine2d, Point2d, Double> - Specified by:
checkLoopBackin interfaceFlattener2d- Specified by:
checkLoopBackin interfaceOffsetFlattener2d
-
checkDirectionError
public boolean checkDirectionError(Double segmentDirection, Double curveDirectionAtStart, Double curveDirectionAtEnd, double maxDirectionDeviation) - Specified by:
checkDirectionErrorin interfaceFlattener<Flattener2d,Curve2d, PolyLine2d, Point2d, Double> - Specified by:
checkDirectionErrorin interfaceFlattener2d- Specified by:
checkDirectionErrorin interfaceOffsetFlattener2d
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
flattener
Returns the value of theflattenerrecord component.- Returns:
- the value of the
flattenerrecord component
-
offsetFlattener
Returns the value of theoffsetFlattenerrecord component.- Returns:
- the value of the
offsetFlattenerrecord component
-