Difference between revisions of "VPlane"
From Valve Developer Community
TomEdwards (talk  contribs) (New page: '''<code>VPlane</code>''' is a C++ class that represents an infinite 2D surface. Each VPlane contains a normalised Vector that defines its facing (<code>m_Normal</code>) and a [[v...) 
m (linked the german translation) 

Line 1:  Line 1:  
+  {{otherlang2  
+  de=VPlane:de  
+  }}  
'''<code>VPlane</code>''' is a C++ class that represents an infinite 2D surface.  '''<code>VPlane</code>''' is a C++ class that represents an infinite 2D surface.  
Latest revision as of 12:28, 26 April 2013
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.