Simple game engine with complete export to scripting language
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

51 lines
1.1 KiB

#ifndef BLUECORE_TRANSFORMATION_H
#define BLUECORE_TRANSFORMATION_H
#include "Quaternion.h"
#include "Vector.h"
namespace BlueCore
{
template<class T> class TransformationTemplate
{
public:
QuaternionTemplate<T> rotation;
Vector3Template<T> translation;
TransformationTemplate()
{
}
template<class S> TransformationTemplate(
const QuaternionTemplate<S> &rot) :
rotation(rot)
{
}
template<class S> TransformationTemplate(
const Vector3Template<S> &trans) :
translation(trans)
{
}
template<class R, class S> TransformationTemplate(
const QuaternionTemplate<S> &rot,
const Vector3Template<S> &trans) :
rotation(rot), translation(trans)
{
}
template<class S> Vector3Template<T> transform(const Vector3Template<S> &v)
{
return rotation.apply(v) + translation;
}
};
typedef TransformationTemplate<float> TransformationFloat;
typedef TransformationTemplate<double> TransformationDouble;
typedef TransformationTemplate<Scalar> Transformation;
} // namespace BlueCore
#endif /*TRANSFORMATION_H_*/