2012-03-24 23:39:19 +01:00
|
|
|
#include <stdio.h>
|
|
|
|
|
|
2020-10-04 00:25:21 +02:00
|
|
|
#include "Common/Math/lin/vec3.h"
|
|
|
|
|
#include "Common/Math/lin/matrix4x4.h"
|
2012-03-24 23:39:19 +01:00
|
|
|
|
2019-10-22 22:58:10 +02:00
|
|
|
namespace Lin {
|
|
|
|
|
|
2012-03-24 23:39:19 +01:00
|
|
|
Vec3 Vec3::operator *(const Matrix4x4 &m) const {
|
2012-10-30 13:20:55 +01:00
|
|
|
return Vec3(x*m.xx + y*m.yx + z*m.zx + m.wx,
|
|
|
|
|
x*m.xy + y*m.yy + z*m.zy + m.wy,
|
|
|
|
|
x*m.xz + y*m.yz + z*m.zz + m.wz);
|
2012-03-24 23:39:19 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Vec3 Vec3::rotatedBy(const Matrix4x4 &m) const {
|
2012-10-30 13:20:55 +01:00
|
|
|
return Vec3(x*m.xx + y*m.yx + z*m.zx,
|
|
|
|
|
x*m.xy + y*m.yy + z*m.zy,
|
|
|
|
|
x*m.xz + y*m.yz + z*m.zz);
|
2012-03-24 23:39:19 +01:00
|
|
|
}
|
2019-10-22 22:58:10 +02:00
|
|
|
|
|
|
|
|
} // namespace Lin
|