A plane class in 2D. More...
Public Member Functions | |
Plane2 (Vector2 a_base, Vector2 a_unit_normal) | |
Plane2 constructor. | |
bool | IsInside (Vector2 point) |
Return true if 'point' is inside the primitive (in its negative space). | |
void | ClosestSurfacePoint (Vector2 point, out Vector2 ret, out float sign) |
Return the closest point to 'point' that lies on the surface of the primitive. | |
float | SignedDistance (Vector2 point) |
Return the signed distance (penetration distance) from 'point' to the surface of the primitive. | |
Vector2 | Project (Vector2 point) |
Project a point on this plane. | |
bool | NegativeClipSegment (ref Vector2 A, ref Vector2 B) |
Assuming the primitive is convex, clip the segment AB against the primitive. | |
Public Attributes | |
Vector2 | Base |
A base point on the plane. | |
Vector2 | UnitNormal |
The plane normal vector, assumed to be unit length. |
A plane class in 2D.
Return the closest point to 'point' that lies on the surface of the primitive.
If that point is inside the primitive, sign is negative.
Implements ICollisionBasics.
Assuming the primitive is convex, clip the segment AB against the primitive.
Return false if AB is entirely in positive halfspace, else clip against negative space and return true.
Implements ICollisionBasics.
The plane normal vector, assumed to be unit length.
If this is not the case, some functions will have undefined behaviour.