Plane2 Struct Reference

A plane class in 2D. More...

Inheritance diagram for Plane2:
ICollisionBasics

List of all members.

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.

Detailed Description

A plane class in 2D.


Member Function Documentation

void ClosestSurfacePoint ( Vector2  point,
out Vector2  ret,
out float  sign 
)

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.

bool NegativeClipSegment ( ref Vector2  A,
ref Vector2  B 
)

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.


Member Data Documentation

The plane normal vector, assumed to be unit length.

If this is not the case, some functions will have undefined behaviour.