Package toxi.geom
Interface Shape2D
- All Known Implementing Classes:
Circle
,Ellipse
,PointQuadtree
,Polygon2D
,Rect
,Triangle2D
public interface Shape2D
Interface description of common operations supported by 2D geometry types.
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Checks if the point is within the given shape.float
getArea()
Computes the area of the shape.Computes the bounding circle of the shape.Returns the shape's axis-aligned bounding rect.float
Computes the shape's circumference.getEdges()
Returns a list of the shape's perimeter edges.Computes a random point within the shape's perimeter.Converts the shape into aPolygon2D
instance (possibly via a default resolution, e.g.
-
Method Details
-
containsPoint
Checks if the point is within the given shape.- Returns:
- true, if inside
-
getArea
float getArea()Computes the area of the shape.- Returns:
- area
-
getBoundingCircle
Circle getBoundingCircle()Computes the bounding circle of the shape.- Returns:
- circle
-
getBounds
Rect getBounds()Returns the shape's axis-aligned bounding rect.- Returns:
- bounding rect
-
getCircumference
float getCircumference()Computes the shape's circumference.- Returns:
- circumference
-
getEdges
Returns a list of the shape's perimeter edges.- Returns:
- list of
Line2D
elements
-
getRandomPoint
Vec2D getRandomPoint()Computes a random point within the shape's perimeter.- Returns:
- Vec2D
-
toPolygon2D
Polygon2D toPolygon2D()Converts the shape into aPolygon2D
instance (possibly via a default resolution, e.g. for circles/ellipses)- Returns:
- shape as polygon
-