Class OffsetRectangleShape

java.lang.Object
org.opentrafficsim.base.geometry.OffsetRectangleShape
All Implemented Interfaces:
Locatable, OtsShape
Direct Known Subclasses:
RectangleShape

public abstract class OffsetRectangleShape extends Object implements OtsShape
Shape defined by an offset rectangle.

Copyright (c) 2024-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

    • OffsetRectangleShape

      public OffsetRectangleShape(double minX, double maxX, double minY, double maxY)
      Constructor.
      Parameters:
      minX - minimum x coordinate.
      maxX - maximum x coordinate.
      minY - minimum y coordinate.
      maxY - maximum y coordinate.
  • Method Details

    • getRelativeContour

      public Polygon2d getRelativeContour()
      Description copied from interface: OtsShape
      Returns the contour of the object in relative coordinates.
      Specified by:
      getRelativeContour in interface OtsShape
      Returns:
      the contour of the object in relative coordinates
    • getRelativeBounds

      public Bounds2d getRelativeBounds()
      Description copied from interface: OtsShape
      Returns the bounds relative to the location. The default implementation returns the bounds of the contour.
      Specified by:
      getRelativeBounds in interface Locatable
      Specified by:
      getRelativeBounds in interface OtsShape
      Returns:
      bounds relative to the location.
    • signedDistance

      public double signedDistance(Point2d point)
      Description copied from interface: OtsShape
      Signed distance function. The point must be relative. Negative distances returned are inside the bounds, with the absolute value of the distance towards the edge. The default implementation is based on the polygon representation, which is expensive.
      Specified by:
      signedDistance in interface OtsShape
      Parameters:
      point - point for which distance is returned.
      Returns:
      distance from point to these bounds.
    • toString

      public String toString()
      Overrides:
      toString in class Object