VPlane
From Valve Developer Community
VPlane
is a C++ class that represents an infinite 2D surface.
Each VPlane contains a normalised Vector that defines its facing (m_Normal
) and a vec_t that defines its distance from the current origin (m_Dist
).
Tip:
m_Dist
can be negative too.Member functions

vec_t DistTo(Vector point)
 The distance between the given point and its nearest point on the plane. Positive if in front, negative if behind.

SideType GetPointSide(Vector point, vec_t epsilon = 0.01f)
 Performs
DistTo()
then processes the result. The optional epsilon value specifies an unsigned threshold within which the return value will be consideredSIDE_ON
. 
SideType
is a redefined int which has #defined values ofSIDE_FRONT
,SIDE_BACK
andSIDE_ON
. 
SideType GetPointSideExact(Vector point)
 As above, but without an epsilon and assuming 0 to be behind the plane.

VPlane Flip()
 Returns a new VPlane with both
m_Dist
andm_Normal
inverted. Does not change the VPlane's own values (butthis = Flip()
would). 
Vector GetPointOnPlane()
 Returns the point on the plane nearest to the current origin.

Vector SnapPointToPlane(const Vector &point)
 Returns a new Vector representing the nearest point on the plane to the given Vector.