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).
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. -
SideTypeis a redefined int which has #defined values ofSIDE_FRONT,SIDE_BACKandSIDE_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_Distandm_Normalinverted. 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.

