GRIM: Fix bounding box calculation. Fix #391

This commit is contained in:
Giulio Camuffo 2011-10-18 17:42:12 +02:00
parent 611a4ff086
commit 46a8d461e0
7 changed files with 79 additions and 48 deletions

View file

@ -49,22 +49,22 @@ void Matrix<4, 4>::transform(Vector3d *v, bool trans) const {
}
Vector3d Matrix<4, 4>::getPosition() const {
return Vector3d(getValue(3, 0), getValue(3, 1), getValue(3, 2));
return Vector3d(getValue(0, 3), getValue(1, 3), getValue(2, 3));
}
void Matrix<4, 4>::setPosition(const Vector3d &v) {
setValue(3, 0, v.x());
setValue(3, 1, v.y());
setValue(3, 2, v.z());
setValue(0, 3, v.x());
setValue(1, 3, v.y());
setValue(2, 3, v.z());
}
void Matrix<4, 4>::translate(const Vector3d &vec) {
Vector3d v(vec);
transform(&v, false);
operator()(3, 0) += v.x();
operator()(3, 1) += v.y();
operator()(3, 2) += v.z();
operator()(0, 3) += v.x();
operator()(1, 3) += v.y();
operator()(2, 3) += v.z();
}
} // end of namespace Math