/ Published in: Other
Works out the distance between two objects in 3D space, you'll need the Vertex3D struct also in my snipppets
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
static inline GLfloat Vertex3DCalculateDistanceBetweenVertices (Vertex3D first, Vertex3D second) { GLfloat deltaX = second.x - first.x; GLfloat deltaY = second.y - first.y; GLfloat deltaZ = second.z - first.z; return sqrtf(deltaX*deltaX + deltaY*deltaY + deltaZ*deltaZ ); };