Class BoundingCircle

java.lang.Object
org.opentrafficsim.base.geometry.BoundingCircle
All Implemented Interfaces:
org.djutils.draw.bounds.Bounds<OtsBounds2d,org.djutils.draw.point.Point2d,org.djutils.draw.Drawable2d>, OtsBounds2d

public class BoundingCircle extends Object implements OtsBounds2d
Bounds 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

    • BoundingCircle

      public BoundingCircle(double radius)
      Constructor.
      Parameters:
      radius - double; radius.
  • Method Details

    • getMinX

      public double getMinX()
      Specified by:
      getMinX in interface org.djutils.draw.bounds.Bounds<OtsBounds2d,org.djutils.draw.point.Point2d,org.djutils.draw.Drawable2d>
      Specified by:
      getMinX in interface OtsBounds2d
    • getMaxX

      public double getMaxX()
      Specified by:
      getMaxX in interface org.djutils.draw.bounds.Bounds<OtsBounds2d,org.djutils.draw.point.Point2d,org.djutils.draw.Drawable2d>
      Specified by:
      getMaxX in interface OtsBounds2d
    • getMinY

      public double getMinY()
      Specified by:
      getMinY in interface org.djutils.draw.bounds.Bounds<OtsBounds2d,org.djutils.draw.point.Point2d,org.djutils.draw.Drawable2d>
      Specified by:
      getMinY in interface OtsBounds2d
    • getMaxY

      public double getMaxY()
      Specified by:
      getMaxY in interface org.djutils.draw.bounds.Bounds<OtsBounds2d,org.djutils.draw.point.Point2d,org.djutils.draw.Drawable2d>
      Specified by:
      getMaxY in interface OtsBounds2d
    • contains

      public boolean contains(org.djutils.draw.point.Point2d point) throws NullPointerException
      Specified by:
      contains in interface org.djutils.draw.bounds.Bounds<OtsBounds2d,org.djutils.draw.point.Point2d,org.djutils.draw.Drawable2d>
      Specified by:
      contains in interface OtsBounds2d
      Throws:
      NullPointerException
    • covers

      public boolean covers(org.djutils.draw.point.Point2d point) throws NullPointerException
      Specified by:
      covers in interface org.djutils.draw.bounds.Bounds<OtsBounds2d,org.djutils.draw.point.Point2d,org.djutils.draw.Drawable2d>
      Specified by:
      covers in interface OtsBounds2d
      Throws:
      NullPointerException
    • signedDistance

      public double signedDistance(org.djutils.draw.point.Point2d point)
      Signed distance function. The coordinates must be transformed to this bound's space. 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 and is expensive.
      Specified by:
      signedDistance in interface OtsBounds2d
      Parameters:
      point - Point2d; point for which distance is returned.
      Returns:
      double; distance from point to these bounds.
    • asPolygon

      public org.djutils.draw.line.Polygon2d asPolygon()
      Returns a polygon representation of the bounds, such that an intersection can be derived.
      Specified by:
      asPolygon in interface OtsBounds2d
      Returns:
      Polygon2d; polygon representation of the bounds.