Package org.opentrafficsim.base.geometry
Interface OtsLocatable
- All Superinterfaces:
nl.tudelft.simulation.dsol.animation.Locatable
,SpatialObject
Locatable that specifies return types.
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
-
Method Summary
Modifier and TypeMethodDescriptionstatic org.djutils.draw.line.Polygon2d
boundsAsContour
(OtsLocatable locatable) Generates a polygon as contour based on bounds and location of the locatable.static org.djutils.draw.bounds.Bounds2d
contourAsBounds
(OtsLocatable locatable) Generates bounds based on polygon and location of the locatable.org.djutils.draw.bounds.Bounds2d
Returns the bounds relative to the location.org.djutils.draw.point.Point2d
default OtsShape
getShape()
Returns the shape relative to the location.static org.djutils.draw.line.Polygon2d
relativeContour
(OtsLocatable locatable) Returns the contour of the locatable translated and rotated such that it is defined relative to the location.static org.djutils.draw.Transform2d
toBoundsTransform
(org.djutils.draw.point.Point2d location) Returns a transformation by which absolute coordinates can be translated and rotated to the frame of the possibly oriented location around which bounds are defined.static org.djutils.draw.Transform2d
toContourTransform
(org.djutils.draw.point.Point2d location) Returns a transformation by which relative coordinates can be translated and rotated to the frame of the possibly oriented location around which bounds are defined.static org.djutils.draw.line.Polygon2d
transformContour
(org.djutils.draw.line.Polygon2d contour, org.djutils.draw.point.Point2d location) Transform the contour from the location to relative coordinates, which may also be anOrientedPoint
for rotation.static org.djutils.draw.line.PolyLine2d
transformLine
(org.djutils.draw.line.PolyLine2d line, org.djutils.draw.point.Point2d location) Transform the line by location, which may also be anOrientedPoint
for rotation.Methods inherited from interface nl.tudelft.simulation.dsol.animation.Locatable
getDirZ, getZ
Methods inherited from interface org.opentrafficsim.base.geometry.SpatialObject
getContour
-
Method Details
-
getLocation
org.djutils.draw.point.Point2d getLocation()- Specified by:
getLocation
in interfacenl.tudelft.simulation.dsol.animation.Locatable
-
getBounds
org.djutils.draw.bounds.Bounds2d getBounds()Returns the bounds relative to the location.- Specified by:
getBounds
in interfacenl.tudelft.simulation.dsol.animation.Locatable
- Returns:
- bounds relative to the location.
-
getShape
Returns the shape relative to the location.- Returns:
- the shape relative to the location.
-
boundsAsContour
Generates a polygon as contour based on bounds and location of the locatable.- Parameters:
locatable
- locatable- Returns:
- contour
-
contourAsBounds
Generates bounds based on polygon and location of the locatable.- Parameters:
locatable
- locatable- Returns:
- bounds
-
relativeContour
Returns the contour of the locatable translated and rotated such that it is defined relative to the location.- Parameters:
locatable
- locatable- Returns:
- contour relative to location
-
transformContour
static org.djutils.draw.line.Polygon2d transformContour(org.djutils.draw.line.Polygon2d contour, org.djutils.draw.point.Point2d location) Transform the contour from the location to relative coordinates, which may also be anOrientedPoint
for rotation.- Parameters:
contour
- contourlocation
- location, which may also be anOrientedPoint
for rotation- Returns:
- transformed contour
-
transformLine
static org.djutils.draw.line.PolyLine2d transformLine(org.djutils.draw.line.PolyLine2d line, org.djutils.draw.point.Point2d location) Transform the line by location, which may also be anOrientedPoint
for rotation.- Parameters:
line
- linelocation
- location, which may also be anOrientedPoint
for rotation- Returns:
- transformed line
-
toBoundsTransform
static org.djutils.draw.Transform2d toBoundsTransform(org.djutils.draw.point.Point2d location) Returns a transformation by which absolute coordinates can be translated and rotated to the frame of the possibly oriented location around which bounds are defined.- Parameters:
location
- location (can be anOriented
).- Returns:
- transformation.
-
toContourTransform
static org.djutils.draw.Transform2d toContourTransform(org.djutils.draw.point.Point2d location) Returns a transformation by which relative coordinates can be translated and rotated to the frame of the possibly oriented location around which bounds are defined.- Parameters:
location
- location (can be anOriented
).- Returns:
- transformation.
-