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.
#ifndef _Math_h_
#define _Math_h_
static float DotProduct(const D3DXVECTOR3 a, const D3DXVECTOR3 b)
I would invoke the function by :
Code:
CVector3 vecA, vecB;
float fDotResult = Math::DotProduct(vecA, vecB)
OR
Code:
#ifndef _Math_h_
#define _Math_h_
class CVector3
{
public:
D3DXVECTOR3 mVector3;
float DotProduct(const D3DXVECTOR3 vec2);
};
I can call this by ...
Code:
CVector3 cVectorA, cVectorB;
float fDotResult = cVectorA.DotProduct(cVectorB);
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.