Hello,

I plan on making a D3DXVECTOR3 wrapper for my project and I was wondering if it was optimal to make math functions be static? Or wrap up the functionality in a class.

I would invoke the function by :Quote:

#ifndef _Math_h_

#define _Math_h_

static float DotProduct(const D3DXVECTOR3 a, const D3DXVECTOR3 b)

ORCode:`CVector3 vecA, vecB;`

float fDotResult = Math::DotProduct(vecA, vecB)

I can call this by ...Code:`#ifndef _Math_h_`

#define _Math_h_

class CVector3

{

public:

D3DXVECTOR3 mVector3;

float DotProduct(const D3DXVECTOR3 vec2);

};

From what I hear, static variables/functions are as slow as global variables/functions so I am curious as to which of the two cases above is better in terms of speed.Code:`CVector3 cVectorA, cVectorB;`

float fDotResult = cVectorA.DotProduct(cVectorB);