Class PolygonShape

java.lang.Object
org.opentrafficsim.base.geometry.PolygonShape
All Implemented Interfaces:
Locatable, OtsShape

public abstract class PolygonShape extends Object implements OtsShape
Shape defined by a polygon.

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

    • PolygonShape

      public PolygonShape(Polygon2d polygon)
      Constructor.
      Parameters:
      polygon - polygon.
  • 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.
    • toString

      public String toString()
      Overrides:
      toString in class Object