Interface Flattener3d

All Superinterfaces:
Flattener<Flattener3d,Curve3d,PolyLine3d,Point3d,Direction3d>
All Known Implementing Classes:
Flattener3d.MaxAngle, Flattener3d.MaxDeviation, Flattener3d.MaxDeviationAndAngle, Flattener3d.NumSegments

public interface Flattener3d extends Flattener<Flattener3d,Curve3d,PolyLine3d,Point3d,Direction3d>
Flattens a Curve3d in to a PolyLine3d.

Copyright (c) 2023-2025 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.

Author:
Alexander Verbraeck, Peter Knoppers, Wouter Schakel
  • Method Details

    • flatten

      PolyLine3d flatten(Curve3d curve)
      Flatten a Curve3d into a PolyLine3d.
      Parameters:
      curve - the curve
      Returns:
      flattened line
      Throws:
      NullPointerException - when curve is null
    • checkInflectionPoint

      default boolean checkInflectionPoint(Flattener.FlattableCurve<Point3d,Direction3d> curve, double prevT, double medianT, double nextT, Point3d prevPoint, Point3d nextPoint)
      Description copied from interface: Flattener
      Check for an inflection point by computing additional points at one quarter and three quarters. If these are on opposite sides of the curve2d from prevPoint to nextPoint; there must be an inflection point. This default implementation is only for the 2d case. https://stackoverflow.com/questions/1560492/how-to-tell-whether-a-point-is-to-the-right-or-left-side-of-a-line
      Specified by:
      checkInflectionPoint in interface Flattener<Flattener3d,Curve3d,PolyLine3d,Point3d,Direction3d>
      Parameters:
      curve - Curve2d
      prevT - t of preceding inserted point
      medianT - t of point currently considered for insertion
      nextT - t of following inserted point
      prevPoint - point on curve at prevT
      nextPoint - point on curve at nextT
      Returns:
      true if there is an inflection point between prevT and nextT; false if there is no inflection point between prevT and nextT
    • checkLoopBack

      default boolean checkLoopBack(Direction3d prevDirection, Direction3d nextDirection)
      Description copied from interface: Flattener
      Check for a direction change of more than 90 degrees. If that happens, the MaxDeviation flattener must zoom in closer.
      Specified by:
      checkLoopBack in interface Flattener<Flattener3d,Curve3d,PolyLine3d,Point3d,Direction3d>
      Parameters:
      prevDirection - the direction at the preceding (already added) point
      nextDirection - the direction at the succeeding (already added) point
      Returns:
      true if the curve changes direction by more than 90 degrees; false if the curve does not change direction by more than 90 degrees
    • checkDirectionError

      default boolean checkDirectionError(Direction3d segmentDirection, Direction3d curveDirectionAtStart, Direction3d curveDirectionAtEnd, double maxDirectionDeviation)
      Description copied from interface: Flattener
      Check direction difference at the start and end of a segment.
      Specified by:
      checkDirectionError in interface Flattener<Flattener3d,Curve3d,PolyLine3d,Point3d,Direction3d>
      Parameters:
      segmentDirection - direction of the segment
      curveDirectionAtStart - direction of the curve at the start of the segment
      curveDirectionAtEnd - direction of the curve at the end of the segment
      maxDirectionDeviation - maximum permitted direction difference
      Returns:
      true if the direction difference at the start and the end of the segment is smaller than maxDirectionDeviation; false if the direction difference at the start, or the end of the segment equals or exceeds maxDirectionDeviation