MCPcopy Create free account
hub / github.com/JACoders/OpenJK / CM_PlaneFromPoints

Function CM_PlaneFromPoints

code/qcommon/cm_patch.cpp:153–165  ·  view source on GitHub ↗

===================== CM_PlaneFromPoints Returns false if the triangle is degenrate. The normal will point out of the clock for clockwise ordered points ===================== */

Source from the content-addressed store, hash-verified

151=====================
152*/
153static qboolean CM_PlaneFromPoints( vec4_t plane, vec3_t a, vec3_t b, vec3_t c ) {
154 vec3_t d1, d2;
155
156 VectorSubtract( b, a, d1 );
157 VectorSubtract( c, a, d2 );
158 CrossProduct( d2, d1, plane );
159 if ( VectorNormalize( plane ) == 0 ) {
160 return qfalse;
161 }
162
163 plane[3] = DotProduct( a, plane );
164 return qtrue;
165}
166
167
168/*

Callers 1

CM_FindPlaneFunction · 0.70

Calls 4

VectorSubtractFunction · 0.85
CrossProductFunction · 0.85
VectorNormalizeFunction · 0.85
DotProductFunction · 0.85

Tested by

no test coverage detected