Class CircleShape

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

public abstract class CircleShape extends Object implements OtsShape
Shape defined by a circle.

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

    • CircleShape

      public CircleShape(double radius)
      Constructor.
      Parameters:
      radius - radius.
    • CircleShape

      public CircleShape(double radius, int polygonSegments)
      Constructor.
      Parameters:
      radius - radius.
      polygonSegments - number of segments in polygon representation.
  • Method Details

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

      public String toString()
      Overrides:
      toString in class Object