Class ContinuousPolyLine

java.lang.Object
org.opentrafficsim.core.geometry.ContinuousPolyLine
All Implemented Interfaces:
ContinuousLine

public class ContinuousPolyLine extends Object implements ContinuousLine
Continuous definition of a PolyLine. Naive approaches are applied for offsets, since polylines have no exact information for this.

Copyright (c) 2023-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
  • Constructor Details

    • ContinuousPolyLine

      public ContinuousPolyLine(org.djutils.draw.line.PolyLine2d line)
      Define continuous line from polyline. Start and end point direction are derived from the line.
      Parameters:
      line - OtsLine2d; line.
    • ContinuousPolyLine

      public ContinuousPolyLine(org.djutils.draw.line.PolyLine2d line, org.djutils.draw.point.OrientedPoint2d startPoint, org.djutils.draw.point.OrientedPoint2d endPoint)
      Define continuous line from polyline. Start and end point are given and may alter the direction at the endpoints (slightly).
      Parameters:
      line - OtsLine2d; line.
      startPoint - OrientedPoint2d; start point.
      endPoint - OrientedPoint2d; end point.
  • Method Details

    • getStartPoint

      public org.djutils.draw.point.OrientedPoint2d getStartPoint()
      Start point.
      Specified by:
      getStartPoint in interface ContinuousLine
      Returns:
      OrientedPoint2d; start point.
    • getEndPoint

      public org.djutils.draw.point.OrientedPoint2d getEndPoint()
      End point.
      Specified by:
      getEndPoint in interface ContinuousLine
      Returns:
      OrientedPoint2d; end point.
    • getStartCurvature

      public double getStartCurvature()
      Start curvature.
      Specified by:
      getStartCurvature in interface ContinuousLine
      Returns:
      double; start curvature.
    • getEndCurvature

      public double getEndCurvature()
      End curvature.
      Specified by:
      getEndCurvature in interface ContinuousLine
      Returns:
      double; end curvature.
    • getStartRadius

      public double getStartRadius()
      Start radius.
      Specified by:
      getStartRadius in interface ContinuousLine
      Returns:
      double; start radius.
    • getEndRadius

      public double getEndRadius()
      End radius.
      Specified by:
      getEndRadius in interface ContinuousLine
      Returns:
      double; end radius.
    • flatten

      public org.djutils.draw.line.PolyLine2d flatten()
      Polyline from continuous line. Returns the line as is.
      Returns:
      PolyLine2d; polyline.
    • flatten

      public org.djutils.draw.line.PolyLine2d flatten(Flattener flattener)
      Returns the line as is. Flattener is ignored.
      Specified by:
      flatten in interface ContinuousLine
      Parameters:
      flattener - Flattener; flattener (ignored).
      Returns:
      PolyLine2d; flattened line.
    • offset

      public org.djutils.draw.line.PolyLine2d offset(FractionalLengthData offsets)
      Returns an offset line. This is a regular offset line, with start and end points moved to be perpendicular to end point directions.
      Parameters:
      offsets - FractionalLengthData; offset data.
      Returns:
      PolyLine2d; flattened line.
    • flattenOffset

      public org.djutils.draw.line.PolyLine2d flattenOffset(FractionalLengthData offsets, Flattener flattener)
      Returns the regular offset. Flattener is ignored.
      Specified by:
      flattenOffset in interface ContinuousLine
      Parameters:
      offsets - FractionalLengthData; offset data.
      flattener - Flattener; flattener (ignored).
      Returns:
      PolyLine2d; flattened line.
    • getLength

      public double getLength()
      Return the length of the line.
      Specified by:
      getLength in interface ContinuousLine
      Returns:
      double; length of the line.
    • toString

      public String toString()
      Overrides:
      toString in class Object