Hi folks, with a bit of time off traveling and an offshoot article about bit fields, time to get back to the plan I had.
In the original post about class design (link) I was just targeting a type of functionality which, if done poorly, can lead to trivial bugs that could have been avoided. I think the responses were all valid and of course I made a couple changes, though I'm still on the fence about one of them because it hurts my world view and I have a different bit of thinking on it. (Yeah, "Normalize" versus helper "Normalized"..
)
Anyway, stripping down the class in question, I ended up with the following (code/comment stripped to get an idea of how 'self documenting it is' and raw feedback before I make comments below and hit the 'reasons'):
class Vector3fv
{
public:
static const size_t kXIndex = 0;
static const size_t kYIndex = 1;
static const size_t kZIndex = 2;
Vector3fv();
Vector3fv( const Vector3fv& rhs );
Vector3fv( float x, float y, float z );
Vector3fv( SIMD::Vec4f_t rhs );
operator SIMD::Vec4f_t();
float X() const;
float Y() const;
float Z() const;
void X( float x );
void Y( float y );
void Z( float z );
float operator ()( size_t index ) const;
void operator ()( size_t index, float v );
void Set( float x, float y, float z );
const Vector3fv& operator =( const Vector3fv& v );
Vector3fv operator -() const;
Vector3fv operator +( const Vector3fv& rhs ) const;
Vector3fv operator -( const Vector3fv& rhs ) const;
Vector3fv operator *( float rhs ) const;
Vector3fv operator /( float rhs ) const;
float operator *( const Vector3fv& rhs ) const;
void operator -=( const Vector3fv& rhs );
void operator +=( const Vector3fv& rhs );
void operator *=( const float rhs );
void operator /=( const float rhs );
void Normalize();
void Cross( const Vector3fv& rhs );
static const Vector3fv kZero;
static const Vector3fv kXAxis;
static const Vector3fv kYAxis;
static const Vector3fv kZAxis;
private:
SIMD::Vec4f_t mData;
};
inline float Dot( const Vector3fv& lhs, const Vector3fv& rhs );
inline Vector3fv Normalize( const Vector3fv& rhs );
inline Vector3fv Cross( const Vector3fv& lhs, const Vector3fv& rhs );
inline float Magnitude( const Vector3fv& lhs, const Vector3fv& rhs );
inline Vector3fv operator *( float lhs, const Vector3fv& rhs );

Find content
Not Telling