Package org.djutils.draw.curve
Class Flattener2d.NumSegments
java.lang.Object
org.djutils.draw.curve.Flattener2d.NumSegments
- All Implemented Interfaces:
Flattener<Flattener2d,
,Curve2d, PolyLine2d, Point2d, Double> Flattener2d
- Enclosing interface:
- Flattener2d
Flattener that approximates the
Curve2d
with a specified number of segments.-
Nested Class Summary
Nested classes/interfaces inherited from interface org.djutils.draw.curve.Flattener
Flattener.FlattableCurve<P,
DIR> Nested classes/interfaces inherited from interface org.djutils.draw.curve.Flattener2d
Flattener2d.MaxAngle, Flattener2d.MaxDeviation, Flattener2d.MaxDeviationAndAngle, Flattener2d.NumSegments
-
Constructor Summary
ConstructorsConstructorDescriptionNumSegments
(int numSegments) Construct a flattener that approximates theCurve2d
with a specified number of segments. -
Method Summary
Modifier and TypeMethodDescriptionFlatten a Curve2d into a PolyLine2d.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.djutils.draw.curve.Flattener
checkInflectionPoint, checkPositionError, loadKnot, loadKnots
Methods inherited from interface org.djutils.draw.curve.Flattener2d
checkDirectionError, checkLoopBack
-
Constructor Details
-
NumSegments
public NumSegments(int numSegments) Construct a flattener that approximates theCurve2d
with a specified number of segments.- Parameters:
numSegments
- number of segments to use in the construction of thePolyLine2d
- Throws:
IllegalArgumentException
- whennumSegments < 1
-
-
Method Details
-
flatten
Description copied from interface:Flattener2d
Flatten a Curve2d into a PolyLine2d.- Specified by:
flatten
in interfaceFlattener2d
- Parameters:
curve
- the curve- Returns:
- flattened line
- Throws:
NullPointerException
- whencurve
isnull
-