Package org.opentrafficsim.base.geometry
Class CircleShape
java.lang.Object
org.opentrafficsim.base.geometry.CircleShape
Shape defined by a circle.
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
ConstructorsConstructorDescriptionCircleShape(double radius) Constructor.CircleShape(double radius, int polygonSegments) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionReturns the bounds relative to the location.Returns the contour of the object in relative coordinates.doublesignedDistance(Point2d point) Signed distance function.toString()Methods 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
-
CircleShape
public CircleShape(double radius) Constructor.- Parameters:
radius- radius.
-
CircleShape
public CircleShape(double radius, int polygonSegments) Constructor.- Parameters:
radius- radius.polygonSegments- number of segments in polygon representation.
-
-
Method Details
-
getRelativeBounds
Description copied from interface:OtsShapeReturns the bounds relative to the location. The default implementation returns the bounds of the contour.- Specified by:
getRelativeBoundsin interfaceLocatable- Specified by:
getRelativeBoundsin interfaceOtsShape- Returns:
- bounds relative to the location.
-
signedDistance
Description copied from interface:OtsShapeSigned 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- Parameters:
point- point for which distance is returned.- Returns:
- distance from point to these bounds.
-
getRelativeContour
Description copied from interface:OtsShapeReturns the contour of the object in relative coordinates.- Specified by:
getRelativeContourin interfaceOtsShape- Returns:
- the contour of the object in relative coordinates
-
toString
-