Class LinkLocation

java.lang.Object
org.opentrafficsim.core.network.LinkLocation
All Implemented Interfaces:
Serializable

public class LinkLocation
extends Object
implements Serializable
"1D" implementation. Mapping on the design line (often the center line) of a road.

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

$LastChangedDate: 2020-01-23 11:14:19 +0100 (Thu, 23 Jan 2020) $, @version $Revision: 6010 $, by $Author: averbraeck $, initial version Oct 22, 2014

Author:
Alexander Verbraeck, Peter Knoppers
See Also:
Serialized Form
  • Constructor Details

    • LinkLocation

      public LinkLocation​(Link link, double fractionalLongitudinalPosition)
      Parameters:
      link - Link; The link of the location of a point relative to the GTU.
      fractionalLongitudinalPosition - double; The fractional position (between 0.0 and 1.0) of the reference point on the link.
    • LinkLocation

      public LinkLocation​(Link link, Length position)
      Parameters:
      link - Link; The link of the location of a point relative to the GTU.
      position - Length; The position as a length of the reference point on the link.
  • Method Details

    • getLink

      public final Link getLink()
      Returns:
      lane.
    • getFractionalLongitudinalPosition

      public final double getFractionalLongitudinalPosition()
      Returns:
      fractionalLongitudinalPosition.
    • getLongitudinalPosition

      public final Length getLongitudinalPosition()
      Returns:
      position as a length as a traveled length on this link.
    • distance

      public final Length distance​(LinkLocation loc)
      Returns the distance to another LinkLocation. If the other location is in front of us, the distance is positive. If it is behind us, it is negative.
      Parameters:
      loc - LinkLocation; the link location to find the distance to.
      Returns:
      the distance to another LinkLocation.
    • toString

      public final String toString()
      Overrides:
      toString in class Object