Return to Snippet

Revision: 22928
at January 26, 2010 05:00 by antonmills

Initial Code
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 );

Initial URL

Initial Description
Works out the distance between two objects in 3D space, you'll need the Vertex3D struct also in my snipppets

Initial Title
OpenGL Distance to object

Initial Tags

Initial Language