Class LaneGeometryUtil

java.lang.Object
org.opentrafficsim.road.network.lane.LaneGeometryUtil

public class LaneGeometryUtil extends Object
This class is an extension (conceptually, not an actual java extension) of OtsGeometryUtil. This utility has access to classes that are specific to the ots-road project, and required to define geometry of objects in this context.

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:
Alexander Verbraeck, Peter Knoppers, Wouter Schakel
  • Method Details

    • getSlices

      public static List<CrossSectionSlice> getSlices(ContinuousLine designLine, org.djunits.value.vdouble.scalar.Length offset, org.djunits.value.vdouble.scalar.Length width)
      Create cross-section slices from constant values.
      Parameters:
      designLine - ContinuousLine; design line.
      offset - Length; offset.
      width - Length; width.
      Returns:
      List<CrossSectionSlice>; list of cross-section slices.
    • getSlices

      public static List<CrossSectionSlice> getSlices(ContinuousLine designLine, org.djunits.value.vdouble.scalar.Length startOffset, org.djunits.value.vdouble.scalar.Length endOffset, org.djunits.value.vdouble.scalar.Length startWidth, org.djunits.value.vdouble.scalar.Length endWidth)
      Create cross-section slices from start and end values.
      Parameters:
      designLine - ContinuousLine; design line.
      startOffset - Length; start offset.
      endOffset - Length; end offset.
      startWidth - Length; start width.
      endWidth - Length; end width.
      Returns:
      List<CrossSectionSlice>; list of cross-section slices.
    • getCenterOffsets

      public static FractionalLengthData getCenterOffsets(ContinuousLine designLine, List<CrossSectionSlice> crossSectionSlices)
      Returns the offsets to use on a ContinuousLine for the left-hand edge.
      Parameters:
      designLine - ContinuousLine; design line.
      crossSectionSlices - List<CrossSectionSlice>; cross-section slices.
      Returns:
      FractionalLengthData; offsets at fractional lengths to use on a ContinuousLine.
    • getLeftEdgeOffsets

      public static FractionalLengthData getLeftEdgeOffsets(ContinuousLine designLine, List<CrossSectionSlice> crossSectionSlices)
      Returns the offsets to use on a ContinuousLine for the left-hand edge.
      Parameters:
      designLine - ContinuousLine; design line.
      crossSectionSlices - List<CrossSectionSlice>; cross-section slices.
      Returns:
      FractionalLengthData; offsets at fractional lengths to use on a ContinuousLine.
    • getRightEdgeOffsets

      public static FractionalLengthData getRightEdgeOffsets(ContinuousLine designLine, List<CrossSectionSlice> crossSectionSlices)
      Returns the offsets to use on a ContinuousLine for the right-hand edge.
      Parameters:
      designLine - ContinuousLine; design line.
      crossSectionSlices - List<CrossSectionSlice>; cross-section slices.
      Returns:
      FractionalLengthData; offsets at fractional lengths to use on a ContinuousLine.
    • getContour

      public static org.djutils.draw.line.Polygon2d getContour(org.djutils.draw.line.PolyLine2d leftEdge, org.djutils.draw.line.PolyLine2d rightEdge)
      Returns the contour based on left and right edge.
      Parameters:
      leftEdge - PolyLine2d; left edge, in design line direction.
      rightEdge - PolyLine2d; right edge, in design line direction.
      Returns:
      Polygon2d; a closed loop of both edges.
    • createStraightLane

      public static Lane createStraightLane(CrossSectionLink link, String id, org.djunits.value.vdouble.scalar.Length offset, org.djunits.value.vdouble.scalar.Length width, LaneType laneType, Map<GtuType,org.djunits.value.vdouble.scalar.Speed> speedLimits)
      Creates a simple straight lane. This method exists to create lanes for simple tests.
      Parameters:
      link - CrossSectionLink; link.
      id - String; id.
      offset - Length; end offset.
      width - Length; end width.
      laneType - LaneType; lane type.
      speedLimits - Map<GtuType, Speed>; speed limit map.
      Returns:
      Lane; lane.
    • createStraightLane

      public static Lane createStraightLane(CrossSectionLink link, String id, org.djunits.value.vdouble.scalar.Length startOffset, org.djunits.value.vdouble.scalar.Length endOffset, org.djunits.value.vdouble.scalar.Length startWidth, org.djunits.value.vdouble.scalar.Length endWidth, LaneType laneType, Map<GtuType,org.djunits.value.vdouble.scalar.Speed> speedLimits)
      Creates a simple straight lane. This method exists to create lanes for simple tests.
      Parameters:
      link - CrossSectionLink; link.
      id - String; id.
      startOffset - Length; start offset.
      endOffset - Length; end offset.
      startWidth - Length; start width.
      endWidth - Length; end width.
      laneType - LaneType; lane type.
      speedLimits - Map<GtuType, Speed>; speed limit map.
      Returns:
      Lane; lane.
    • createStraightLane

      public static Lane createStraightLane(CrossSectionLink link, String id, List<CrossSectionSlice> slices, LaneType laneType, Map<GtuType,org.djunits.value.vdouble.scalar.Speed> speedLimits)
      Creates a simple straight lane. This method exists to create lanes for simple tests.
      Parameters:
      link - CrossSectionLink; link.
      id - String; id.
      slices - List<CrossSectionSlice>; slices.
      laneType - LaneType; lane type.
      speedLimits - Map<GtuType, Speed>; speed limit map.
      Returns:
      Lane; lane.
    • createStraightStripe

      public static Stripe createStraightStripe(Stripe.Type type, CrossSectionLink link, org.djunits.value.vdouble.scalar.Length offset, org.djunits.value.vdouble.scalar.Length width)
      Creates a simple straight lane. This method exists to create lanes for simple tests.
      Parameters:
      type - Type; stripe type.
      link - CrossSectionLink; link.
      offset - Length; end offset.
      width - Length; end width.
      Returns:
      Lane; lane.
    • createStraightShoulder

      public static Object createStraightShoulder(CrossSectionLink link, String id, org.djunits.value.vdouble.scalar.Length startOffset, org.djunits.value.vdouble.scalar.Length endOffset, org.djunits.value.vdouble.scalar.Length startWidth, org.djunits.value.vdouble.scalar.Length endWidth, LaneType laneType)
      Creates a simple straight shoulder. This method exists to create shoulders for simple tests.
      Parameters:
      link - CrossSectionLink; link.
      id - String; id.
      startOffset - Length; start offset.
      endOffset - Length; end offset.
      startWidth - Length; start width.
      endWidth - Length; end width.
      laneType - LaneType; lane type.
      Returns:
      Lane; lane.