Package org.opentrafficsim.base.geometry
Class BoundingPolygon
java.lang.Object
org.opentrafficsim.base.geometry.BoundingPolygon
- All Implemented Interfaces:
org.djutils.draw.bounds.Bounds<OtsBounds2d,
,org.djutils.draw.point.Point2d, org.djutils.draw.Drawable2d> OtsBounds2d
Bounds defined by a polygon.
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.static BoundingPolygon
geometryToBounds
(org.djutils.draw.point.OrientedPoint2d location, org.djutils.draw.line.PolyLine2d geometry) Translates absolute geometry to bounds relative to location, including rotation.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, contains, covers, covers, disjoint, getMaxX, getMaxY, getMinX, getMinY, intersection, intersects, midPoint, signedDistance
-
Constructor Details
-
BoundingPolygon
public BoundingPolygon(org.djutils.draw.line.Polygon2d polygon) Constructor.- Parameters:
polygon
- Polygon2d; polygon.
-
-
Method Details
-
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.
-
geometryToBounds
public static BoundingPolygon geometryToBounds(org.djutils.draw.point.OrientedPoint2d location, org.djutils.draw.line.PolyLine2d geometry) Translates absolute geometry to bounds relative to location, including rotation.- Parameters:
location
- OrientedPoint2d; location.geometry
- PolyLine2d; geometry..- Returns:
- BoundingPolygon; bounded polygon.
-