Class 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-2022 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
    BSD-style license. See OpenTrafficSim License.

    $LastChangedDate$, @version $Revision$, by $Author$, initial version Oct 22, 2014

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

      • 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 Detail

      • 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.