MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / vm_GetPerp

Function vm_GetPerp

scripts/osiris_vector.h:252–262  ·  view source on GitHub ↗

Calculates the perpendicular vector given three points Parms: n - the computed perp vector (filled in) v0,v1,v2 - three clockwise vertices

Source from the content-addressed store, hash-verified

250// Parms: n - the computed perp vector (filled in)
251// v0,v1,v2 - three clockwise vertices
252void vm_GetPerp(vector *n, vector *a, vector *b, vector *c) {
253 // Given 3 vertices, return the surface normal in n
254 // IMPORTANT: B must be the 'corner' vertex
255
256 vector x, y;
257
258 vm_SubVectors(&x, b, a);
259 vm_SubVectors(&y, c, b);
260
261 vm_CrossProduct(n, &x, &y);
262}
263
264// Calculates the (normalized) surface normal give three points
265// Parms: n - the computed surface normal (filled in)

Callers 3

vm_GetNormalFunction · 0.70
vm_GetCentroidFunction · 0.70
vm_GetCentroidFastFunction · 0.70

Calls 2

vm_SubVectorsFunction · 0.70
vm_CrossProductFunction · 0.70

Tested by

no test coverage detected