initial commit
This commit is contained in:
51
engine/Math/Transformation.h
Normal file
51
engine/Math/Transformation.h
Normal file
@@ -0,0 +1,51 @@
|
||||
#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_*/
|
Reference in New Issue
Block a user