Rev 5 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
#ifndef __CGLA_ARITHVEC4FLOAT_H__
#define __CGLA_ARITHVEC4FLOAT_H__
#include "ArithVecFloat.h"
namespace CGLA {
/** \brief A four dimensional floating point vector template.
This class is also used (via typedef) for
homogeneous vectors.
*/
template<class T, class V>
class ArithVec4Float: public ArithVecFloat<T,V,4>
{
public:
/// Construct a (0,0,0,0) homogenous Vector
ArithVec4Float() {}
/// Construct a 4D vector
ArithVec4Float(T a, T b, T c, T d):
ArithVecFloat<T,V,4>(a,b,c,d) {}
/// Divide all coordinates by the fourth coordinate
void de_homogenize()
{
float k = 1.0/(*this)[3];
(*this)[0] = (*this)[0]*k;
(*this)[1] = (*this)[1]*k;
(*this)[2] = (*this)[2]*k;
(*this)[3] = 1.0;
}
};
}
#endif