Package org.opentrafficsim.base.geometry
Class RectangleShape
java.lang.Object
org.opentrafficsim.base.geometry.OffsetRectangleShape
org.opentrafficsim.base.geometry.RectangleShape
Shape defined by a 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.OtsShape
DEFAULT_POLYGON_SEGMENTS, WORLD_MARGIN_LINE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondoublesignedDistance(Point2d point) Signed distance function.toString()Methods inherited from class org.opentrafficsim.base.geometry.OffsetRectangleShape
getRelativeBounds, getRelativeContourMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.opentrafficsim.base.geometry.OtsShape
contains, contains, getAbsoluteBounds, getAbsoluteContour, getAbsoluteContour, getDirZ, getLocation, signedDistance
-
Constructor Details
-
RectangleShape
public RectangleShape(double dx, double dy) Constructor.- Parameters:
dx- complete length along x dimension.dy- complete length along y dimension.
-
-
Method Details
-
signedDistance
Signed distance function. The point must be relative. 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, which is expensive.- Specified by:
signedDistancein interfaceOtsShape- Overrides:
signedDistancein classOffsetRectangleShape- Parameters:
point- point for which distance is returned.- Returns:
- distance from point to these bounds.
- See Also:
-
toString
- Overrides:
toStringin classOffsetRectangleShape
-