Package org.opentrafficsim.base.geometry
Interface OtsBounds2d
- All Superinterfaces:
org.djutils.draw.bounds.Bounds<OtsBounds2d,
org.djutils.draw.point.Point2d, org.djutils.draw.Drawable2d>
- All Known Implementing Classes:
BoundingBox
,BoundingBoxRounded
,BoundingCircle
,BoundingPolygon
,BoundingRectangle
public interface OtsBounds2d
extends org.djutils.draw.bounds.Bounds<OtsBounds2d,org.djutils.draw.point.Point2d,org.djutils.draw.Drawable2d>
Bounds for generic usage within the OTS context. All input is assumed to be transformed to this bound's space. Default
methods use the polygon representation of the bounds. For many shapes there may be faster methods to determine information.
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
Modifier and TypeFieldDescriptionstatic final org.djutils.draw.point.Point2d
Standard mid point. -
Method Summary
Modifier and TypeMethodDescriptionorg.djutils.draw.line.Polygon2d
Returns a polygon representation of the bounds, such that an intersection can be derived.default boolean
contains
(org.djutils.draw.Drawable2d drawable) default boolean
contains
(org.djutils.draw.point.Point2d point) default boolean
covers
(org.djutils.draw.Drawable2d drawable) default boolean
covers
(org.djutils.draw.point.Point2d point) default boolean
disjoint
(org.djutils.draw.Drawable2d drawable) default double
getMaxX()
default double
getMaxY()
default double
getMinX()
default double
getMinY()
default OtsBounds2d
intersection
(OtsBounds2d otherBounds) default boolean
intersects
(OtsBounds2d otherBounds) default org.djutils.draw.point.Point2d
midPoint()
default double
signedDistance
(org.djutils.draw.point.Point2d point) Signed distance function.Methods inherited from interface org.djutils.draw.bounds.Bounds
getDeltaX, getDeltaY
-
Field Details
-
CENTER
static final org.djutils.draw.point.Point2d CENTERStandard mid point.
-
-
Method Details
-
getMinX
default double getMinX()- Specified by:
getMinX
in interfaceorg.djutils.draw.bounds.Bounds<OtsBounds2d,
org.djutils.draw.point.Point2d, org.djutils.draw.Drawable2d>
-
getMaxX
default double getMaxX()- Specified by:
getMaxX
in interfaceorg.djutils.draw.bounds.Bounds<OtsBounds2d,
org.djutils.draw.point.Point2d, org.djutils.draw.Drawable2d>
-
getMinY
default double getMinY()- Specified by:
getMinY
in interfaceorg.djutils.draw.bounds.Bounds<OtsBounds2d,
org.djutils.draw.point.Point2d, org.djutils.draw.Drawable2d>
-
getMaxY
default double getMaxY()- Specified by:
getMaxY
in interfaceorg.djutils.draw.bounds.Bounds<OtsBounds2d,
org.djutils.draw.point.Point2d, org.djutils.draw.Drawable2d>
-
midPoint
default org.djutils.draw.point.Point2d midPoint()- Specified by:
midPoint
in interfaceorg.djutils.draw.bounds.Bounds<OtsBounds2d,
org.djutils.draw.point.Point2d, org.djutils.draw.Drawable2d>
-
contains
- Specified by:
contains
in interfaceorg.djutils.draw.bounds.Bounds<OtsBounds2d,
org.djutils.draw.point.Point2d, org.djutils.draw.Drawable2d> - Throws:
NullPointerException
-
covers
- Specified by:
covers
in interfaceorg.djutils.draw.bounds.Bounds<OtsBounds2d,
org.djutils.draw.point.Point2d, org.djutils.draw.Drawable2d> - Throws:
NullPointerException
-
covers
- Specified by:
covers
in interfaceorg.djutils.draw.bounds.Bounds<OtsBounds2d,
org.djutils.draw.point.Point2d, org.djutils.draw.Drawable2d> - Throws:
NullPointerException
-
contains
- Specified by:
contains
in interfaceorg.djutils.draw.bounds.Bounds<OtsBounds2d,
org.djutils.draw.point.Point2d, org.djutils.draw.Drawable2d> - Throws:
NullPointerException
-
disjoint
- Specified by:
disjoint
in interfaceorg.djutils.draw.bounds.Bounds<OtsBounds2d,
org.djutils.draw.point.Point2d, org.djutils.draw.Drawable2d> - Throws:
NullPointerException
-
intersects
- Specified by:
intersects
in interfaceorg.djutils.draw.bounds.Bounds<OtsBounds2d,
org.djutils.draw.point.Point2d, org.djutils.draw.Drawable2d>
-
intersection
- Specified by:
intersection
in interfaceorg.djutils.draw.bounds.Bounds<OtsBounds2d,
org.djutils.draw.point.Point2d, org.djutils.draw.Drawable2d>
-
asPolygon
org.djutils.draw.line.Polygon2d asPolygon()Returns a polygon representation of the bounds, such that an intersection can be derived.- Returns:
- Polygon2d; polygon representation of the bounds.
-
signedDistance
default 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.- Parameters:
point
- Point2d; point for which distance is returned.- Returns:
- double; distance from point to these bounds.
-