- Object
-
- Penetration
-
- All Implemented Interfaces:
Copyable<Penetration>
,Shiftable
public class Penetration extends Object implements Shiftable, Copyable<Penetration>
Represents aPenetration
of oneConvex
Shape
into another.The penetration normal should always be a normalized vector that points from the first
Convex
Shape
to the second.- Since:
- 1.0.0
- Version:
- 4.0.0
- Author:
- William Bittle
-
-
Constructor Summary
Constructors Modifier Constructor Description Penetration()
Default constructor.protected
Penetration(Vector2 normal, double depth)
Full constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clear()
Clears the penetration information.Penetration
copy()
Returns a deep copy of this object.void
copy(Penetration penetration)
Copies (deep) the givenPenetration
information to thisPenetration
.double
getDepth()
Returns the penetration depth.Vector2
getNormal()
Returns the penetration normal.void
setDepth(double depth)
Sets the penetration depth.void
setNormal(Vector2 normal)
Sets the penetration normal.void
shift(Vector2 shift)
Translates the object to match the given coordinate shift.String
toString()
-
-
-
Field Detail
-
normal
protected final Vector2 normal
The normalized axis of projection
-
depth
protected double depth
The penetration amount on this axis
-
-
Method Detail
-
clear
public void clear()
Clears the penetration information.
-
getDepth
public double getDepth()
Returns the penetration depth.- Returns:
- double
-
setNormal
public void setNormal(Vector2 normal)
Sets the penetration normal.Must be normalized.
- Parameters:
normal
- the penetration normal
-
setDepth
public void setDepth(double depth)
Sets the penetration depth.- Parameters:
depth
- the penetration depth
-
copy
public void copy(Penetration penetration)
Copies (deep) the givenPenetration
information to thisPenetration
.- Parameters:
penetration
- the penetration 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 Penetration copy()
Description copied from interface:Copyable
Returns a deep copy of this object.- Specified by:
copy
in interfaceCopyable<Penetration>
- Returns:
- T
-
-