Package org.djutils.draw.curve
Class TestCurves
java.lang.Object
org.djutils.draw.curve.TestCurves
TestCurves.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.
TODO test flattener Beziers that are not based on just two DirectedPoint objects.
TODO also with maxAngle flattener and non-declared knot.
TODO test flattener with curve that has a knot.
- Author:
- Alexander Verbraeck, Peter Knoppers, Wouter Schakel
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final double
Maximum permissible exceeding of precision. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
printSituation
(int segment, double positionOnSegment, PolyLine2d flattened, Object curve, double fraction, ContinuousPiecewiseLinearFunction of) Print things for debugging.static void
printSituation
(int segment, double positionOnSegment, PolyLine3d flattened, org.djutils.draw.curve.Curve3d curve, double fraction) Print things for debugging.void
testArc()
Test the ContinuousArc class.void
Test the Bezier2d and BezierCubic2d classes.void
Test the various constructors of Bezier2d.void
Test the Bezier3d and CubicBezier3d classes.void
Test the various constructors of Bezier3d.void
Check the startRadius and endRadius of CubicBezier2d and getT.void
Test the various exceptions of the flatteners.void
Test the ContinuousStraight class.static void
verifyMaxAngleDeviation
(PolyLine2d flattened, org.djutils.draw.curve.Curve2d curve, double anglePrecision) Verify that a flattened FlattableLine2d has matches direction with the flattableLine2d.static void
verifyMaxAngleDeviation
(PolyLine2d flattened, OffsetCurve2d curve, ContinuousPiecewiseLinearFunction of, double anglePrecision) Verify that a flattened FlattableLine2d has no knots sharper than specified, except at the boundary points in the ContinuousPiecewiseLinearFunction.static void
verifyMaxAngleDeviation
(PolyLine3d flattened, org.djutils.draw.curve.Curve3d curve, double anglePrecision) Verify that a flattened FlattableLine2d has matches direction with the flattableLine2d.
-
Field Details
-
FUDGE_FACTOR
public static final double FUDGE_FACTORMaximum permissible exceeding of precision. Needed due to the simple-minded way that the Flattener works.- See Also:
-
-
Constructor Details
-
TestCurves
public TestCurves()
-
-
Method Details
-
testStraight
@Test public void testStraight()Test the ContinuousStraight class. -
testArc
@Test public void testArc()Test the ContinuousArc class. -
printSituation
public static void printSituation(int segment, double positionOnSegment, PolyLine2d flattened, Object curve, double fraction, ContinuousPiecewiseLinearFunction of) Print things for debugging.- Parameters:
segment
- the step along the curve or the polyLine2dpositionOnSegment
- doubleflattened
- PolyLine2dcurve
- Objectfraction
- doubleof
- ContinuousPiecewiseLinearFunction (may be null)
-
printSituation
public static void printSituation(int segment, double positionOnSegment, PolyLine3d flattened, org.djutils.draw.curve.Curve3d curve, double fraction) Print things for debugging.- Parameters:
segment
- the step along the curve or the polyLine2dpositionOnSegment
- doubleflattened
- PolyLine3dcurve
- Curve3dfraction
- double
-
verifyMaxAngleDeviation
public static void verifyMaxAngleDeviation(PolyLine2d flattened, org.djutils.draw.curve.Curve2d curve, double anglePrecision) Verify that a flattened FlattableLine2d has matches direction with the flattableLine2d.- Parameters:
flattened
- PolyLine2dcurve
- FlattableLine2danglePrecision
- double
-
verifyMaxAngleDeviation
public static void verifyMaxAngleDeviation(PolyLine2d flattened, OffsetCurve2d curve, ContinuousPiecewiseLinearFunction of, double anglePrecision) Verify that a flattened FlattableLine2d has no knots sharper than specified, except at the boundary points in the ContinuousPiecewiseLinearFunction.- Parameters:
flattened
- PolyLine2dcurve
- OffsetFlattableLine2dof
- ContinuousPiecewiseLinearFunctionanglePrecision
- double
-
verifyMaxAngleDeviation
public static void verifyMaxAngleDeviation(PolyLine3d flattened, org.djutils.draw.curve.Curve3d curve, double anglePrecision) Verify that a flattened FlattableLine2d has matches direction with the flattableLine2d.- Parameters:
flattened
- PolyLine3dcurve
- FlattableLine3danglePrecision
- double
-
testBezier2d
@Test public void testBezier2d()Test the Bezier2d and BezierCubic2d classes. -
testCubicbezierRadiusAndSome
@Test public void testCubicbezierRadiusAndSome()Check the startRadius and endRadius of CubicBezier2d and getT. -
testBezier3d
@Test public void testBezier3d()Test the Bezier3d and CubicBezier3d classes. -
testFlattenerExceptions
@Test public void testFlattenerExceptions()Test the various exceptions of the flatteners. -
testBezier2dConstructors
@Test public void testBezier2dConstructors()Test the various constructors of Bezier2d. -
testBezier3dConstructors
@Test public void testBezier3dConstructors()Test the various constructors of Bezier3d.
-