Class TestCurves

java.lang.Object
org.djutils.draw.curve.TestCurves

public class TestCurves extends Object
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 Details

    • FUDGE_FACTOR

      public static final double FUDGE_FACTOR
      Maximum 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 polyLine2d
      positionOnSegment - double
      flattened - PolyLine2d
      curve - Object
      fraction - double
      of - 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 polyLine2d
      positionOnSegment - double
      flattened - PolyLine3d
      curve - Curve3d
      fraction - 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 - PolyLine2d
      curve - FlattableLine2d
      anglePrecision - 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 - PolyLine2d
      curve - OffsetFlattableLine2d
      of - ContinuousPiecewiseLinearFunction
      anglePrecision - 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 - PolyLine3d
      curve - FlattableLine3d
      anglePrecision - 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.