-
- All Superinterfaces:
DataContainer
,Rotatable
,Shape
,Transformable
,Translatable
- All Known Implementing Classes:
Capsule
,Circle
,Ellipse
,HalfEllipse
,Link
,Polygon
,Rectangle
,Segment
,Slice
,Triangle
public interface Convex extends Shape, Transformable, DataContainer
Represents aConvex
Shape
.A
Convex
Shape
is aShape
that given a line, the line will only intersect at most 2 non-coincident non-colinear edges.Working with convex shapes specifically allows collision detection algorithms to be very fast. If non-convex shapes are required, they are typically handled by attaching multiple convex shapes together.
- Since:
- 1.0.0
- Version:
- 1.0.3
- Author:
- William Bittle
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Vector2[]
getAxes(Vector2[] foci, Transform transform)
Returns an array of separating axes to test for thisShape
.Feature
getFarthestFeature(Vector2 vector, Transform transform)
Returns theFeature
farthest in the direction of the given vector.Vector2
getFarthestPoint(Vector2 vector, Transform transform)
Returns the point farthest in the direction of the given vector.Vector2[]
getFoci(Transform transform)
Returns an array of world space foci points for circular curved edges.-
Methods inherited from interface DataContainer
getUserData, setUserData
-
Methods inherited from interface Shape
computeAABB, computeAABB, contains, contains, createAABB, createAABB, createMass, getCenter, getRadius, getRadius, project, project, rotateAboutCenter
-
Methods inherited from interface Translatable
translate, translate
-
-
-
-
Method Detail
-
getAxes
Vector2[] getAxes(Vector2[] foci, Transform transform)
Returns an array of separating axes to test for thisShape
.The
foci
parameter is an array of circular focal points of the otherShape
.If foci points are given, this method will return the separating axes for this
Shape
's voronoi regions also. The points in the foci array are assumed to be in world space.The returned axes are normalized and in world space.
-
getFoci
Vector2[] getFoci(Transform transform)
Returns an array of world space foci points for circular curved edges.This method returns null if the
Shape
has zero curved edges.The returned points are in world space.
- Parameters:
transform
- the local to world spaceTransform
of thisConvex
Shape
- Returns:
Vector2
[]- Throws:
UnsupportedOperationException
- if this shape doesn't support this method
-
getFarthestFeature
Feature getFarthestFeature(Vector2 vector, Transform transform)
Returns theFeature
farthest in the direction of the given vector.The returned feature is in world space.
-
-