Package org.opentrafficsim.base.geometry
Class BoundingBoxRounded
java.lang.Object
org.opentrafficsim.base.geometry.BoundingBoxRounded
- All Implemented Interfaces:
org.djutils.draw.bounds.Bounds<OtsBounds2d,
,org.djutils.draw.point.Point2d, org.djutils.draw.Drawable2d> OtsBounds2d
Bounds defined by a rounded 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
-
Field Summary
Fields inherited from interface org.opentrafficsim.base.geometry.OtsBounds2d
CENTER
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionorg.djutils.draw.line.Polygon2d
Returns a polygon representation of the bounds, such that an intersection can be derived.boolean
contains
(org.djutils.draw.point.Point2d point) boolean
covers
(org.djutils.draw.point.Point2d point) double
getMaxX()
double
getMaxY()
double
getMinX()
double
getMinY()
double
signedDistance
(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, wait
Methods inherited from interface org.djutils.draw.bounds.Bounds
getDeltaX, getDeltaY
Methods inherited from interface org.opentrafficsim.base.geometry.OtsBounds2d
contains, covers, disjoint, intersection, intersects, midPoint
-
Constructor Details
-
BoundingBoxRounded
public BoundingBoxRounded(double dx, double dy, double r) Constructor.- Parameters:
dx
- double; complete length along x dimension.dy
- double; complete length along y dimension.r
- double; radius of rounding, must be positive.
-
-
Method Details
-
getMinX
public double getMinX()- Specified by:
getMinX
in interfaceorg.djutils.draw.bounds.Bounds<OtsBounds2d,
org.djutils.draw.point.Point2d, org.djutils.draw.Drawable2d> - Specified by:
getMinX
in interfaceOtsBounds2d
-
getMaxX
public double getMaxX()- Specified by:
getMaxX
in interfaceorg.djutils.draw.bounds.Bounds<OtsBounds2d,
org.djutils.draw.point.Point2d, org.djutils.draw.Drawable2d> - Specified by:
getMaxX
in interfaceOtsBounds2d
-
getMinY
public double getMinY()- Specified by:
getMinY
in interfaceorg.djutils.draw.bounds.Bounds<OtsBounds2d,
org.djutils.draw.point.Point2d, org.djutils.draw.Drawable2d> - Specified by:
getMinY
in interfaceOtsBounds2d
-
getMaxY
public double getMaxY()- Specified by:
getMaxY
in interfaceorg.djutils.draw.bounds.Bounds<OtsBounds2d,
org.djutils.draw.point.Point2d, org.djutils.draw.Drawable2d> - Specified by:
getMaxY
in interfaceOtsBounds2d
-
contains
- Specified by:
contains
in interfaceorg.djutils.draw.bounds.Bounds<OtsBounds2d,
org.djutils.draw.point.Point2d, org.djutils.draw.Drawable2d> - Specified by:
contains
in interfaceOtsBounds2d
- Throws:
NullPointerException
-
covers
- Specified by:
covers
in interfaceorg.djutils.draw.bounds.Bounds<OtsBounds2d,
org.djutils.draw.point.Point2d, org.djutils.draw.Drawable2d> - Specified by:
covers
in 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:
signedDistance
in interfaceOtsBounds2d
- Parameters:
point
- Point2d; point for which distance is returned.- Returns:
- double; distance from point to these bounds.
- See Also:
-
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 interfaceOtsBounds2d
- Returns:
- Polygon2d; polygon representation of the bounds.
-