Package org.opentrafficsim.base.geometry
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
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
-
Field Summary
Fields inherited from interface org.opentrafficsim.base.geometry.OtsBounds2d
CENTER -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.djutils.draw.line.Polygon2dReturns a polygon representation of the bounds, such that an intersection can be derived.booleancontains(org.djutils.draw.point.Point2d point) booleancovers(org.djutils.draw.point.Point2d point) doublegetMaxX()doublegetMaxY()doublegetMinX()doublegetMinY()doublesignedDistance(org.djutils.draw.point.Point2d point) Signed distance function.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.djutils.draw.bounds.Bounds
getDeltaX, getDeltaYMethods inherited from interface org.opentrafficsim.base.geometry.OtsBounds2d
contains, covers, disjoint, intersection, intersects, midPoint
-
Constructor Details
-
BoundingCircle
public BoundingCircle(double radius) Constructor.- Parameters:
radius- double; radius.
-
-
Method Details
-
getMinX
public double getMinX()- Specified by:
getMinXin interfaceorg.djutils.draw.bounds.Bounds<OtsBounds2d,org.djutils.draw.point.Point2d, org.djutils.draw.Drawable2d> - Specified by:
getMinXin interfaceOtsBounds2d
-
getMaxX
public double getMaxX()- Specified by:
getMaxXin interfaceorg.djutils.draw.bounds.Bounds<OtsBounds2d,org.djutils.draw.point.Point2d, org.djutils.draw.Drawable2d> - Specified by:
getMaxXin interfaceOtsBounds2d
-
getMinY
public double getMinY()- Specified by:
getMinYin interfaceorg.djutils.draw.bounds.Bounds<OtsBounds2d,org.djutils.draw.point.Point2d, org.djutils.draw.Drawable2d> - Specified by:
getMinYin interfaceOtsBounds2d
-
getMaxY
public double getMaxY()- Specified by:
getMaxYin interfaceorg.djutils.draw.bounds.Bounds<OtsBounds2d,org.djutils.draw.point.Point2d, org.djutils.draw.Drawable2d> - Specified by:
getMaxYin interfaceOtsBounds2d
-
contains
- Specified by:
containsin interfaceorg.djutils.draw.bounds.Bounds<OtsBounds2d,org.djutils.draw.point.Point2d, org.djutils.draw.Drawable2d> - Specified by:
containsin interfaceOtsBounds2d- Throws:
NullPointerException
-
covers
- Specified by:
coversin interfaceorg.djutils.draw.bounds.Bounds<OtsBounds2d,org.djutils.draw.point.Point2d, org.djutils.draw.Drawable2d> - Specified by:
coversin interfaceOtsBounds2d- 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:
signedDistancein interfaceOtsBounds2d- 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:
asPolygonin interfaceOtsBounds2d- Returns:
- Polygon2d; polygon representation of the bounds.
-