- Object
-
- ManifoldPoint
-
- All Implemented Interfaces:
Copyable<ManifoldPoint>
,Shiftable
public class ManifoldPoint extends Object implements Shiftable, Copyable<ManifoldPoint>
Represents a single contact point in a contactManifold
.The depth represents the distance along the
Manifold
normal to this contact point. This can vary for everyManifoldPoint
in aManifold
.- Since:
- 1.0.0
- Version:
- 4.0.0
- Author:
- William Bittle
- See Also:
Manifold
-
-
Field Summary
Fields Modifier and Type Field Description protected double
depth
The penetration depthprotected ManifoldPointId
id
The id for this manifold pointprotected Vector2
point
The point in world coordinates
-
Constructor Summary
Constructors Modifier Constructor Description ManifoldPoint(ManifoldPointId id)
Optional constructor.protected
ManifoldPoint(ManifoldPointId id, Vector2 point, double depth)
Full constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ManifoldPoint
copy()
Returns a deep copy of this object.void
copy(ManifoldPoint manifoldPoint)
Copies (deep) the givenManifoldPoint
to thisManifoldPoint
.double
getDepth()
Returns the collision depth of the manifold point.ManifoldPointId
getId()
Returns the id for this manifold point.Vector2
getPoint()
Returns the contact point.void
setDepth(double depth)
Sets the collision depth of the manifold point.void
setPoint(Vector2 point)
Sets the contact point.void
shift(Vector2 shift)
Translates the object to match the given coordinate shift.String
toString()
-
-
-
Field Detail
-
id
protected ManifoldPointId id
The id for this manifold point
-
point
protected final Vector2 point
The point in world coordinates
-
depth
protected double depth
The penetration depth
-
-
Constructor Detail
-
ManifoldPoint
public ManifoldPoint(ManifoldPointId id)
Optional constructor.- Parameters:
id
- the id for this manifold point; cannot be null
-
ManifoldPoint
protected ManifoldPoint(ManifoldPointId id, Vector2 point, double depth)
Full constructor.- Parameters:
id
- the id for this manifold pointpoint
- the manifold point in world coordinatesdepth
- the penetration depth
-
-
Method Detail
-
getId
public ManifoldPointId getId()
Returns the id for this manifold point.- Returns:
ManifoldPointId
-
getPoint
public Vector2 getPoint()
Returns the contact point.- Returns:
Vector2
the point in world coordinates
-
setPoint
public void setPoint(Vector2 point)
Sets the contact point.- Parameters:
point
- the point in world coordinates- Since:
- 3.1.5
-
getDepth
public double getDepth()
Returns the collision depth of the manifold point.- Returns:
- double
-
setDepth
public void setDepth(double depth)
Sets the collision depth of the manifold point.- Parameters:
depth
- the depth- Since:
- 3.1.5
-
copy
public void copy(ManifoldPoint manifoldPoint)
Copies (deep) the givenManifoldPoint
to thisManifoldPoint
.- Parameters:
manifoldPoint
- the manifold point to copy- Since:
- 4.0.0
-
shift
public void shift(Vector2 shift)
Description copied from interface:Shiftable
Translates the object to match the given coordinate shift.
-
copy
public ManifoldPoint copy()
Description copied from interface:Copyable
Returns a deep copy of this object.- Specified by:
copy
in interfaceCopyable<ManifoldPoint>
- Returns:
- T
-
-