Class ContinuousStraight

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

public class ContinuousStraight extends Object implements ContinuousLine
Continuous definition of a straight.

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

    • ContinuousStraight

      public ContinuousStraight(org.djutils.draw.point.OrientedPoint2d startPoint, double length)
      Constructor.
      Parameters:
      startPoint - start point.
      length - length.
  • Method Details

    • getStartPoint

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

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

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

      public double getEndCurvature()
      Description copied from interface: ContinuousLine
      End curvature.
      Specified by:
      getEndCurvature in interface ContinuousLine
      Returns:
      end curvature
    • flatten

      public org.djutils.draw.line.PolyLine2d flatten()
      Polyline from continuous line. A straight uses no segments.
      Returns:
      polyline.
    • flatten

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

      public org.djutils.draw.line.PolyLine2d offset(ContinuousLine.ContinuousDoubleFunction offset)
      Offset polyline based on variable offset. A straight uses no segments, other than for varying offset.
      Parameters:
      offset - offset, should contain keys 0.0 and 1.0.
      Returns:
      offset polyline
    • flattenOffset

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

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

      public String toString()
      Overrides:
      toString in class Object