void Transform::setRotationComponent(const Vector3& axis, Real angle) { if (isIdentity || isPureTranslationRotation) { hasRotation=true; Quat4 q; q.setRotation(axis,angle); orient = q; if (isIdentity) hasTranslation=isIdentity=false; } else { Matrix4 r(Quat4(axis,angle)); r.e(4,4)=0; Matrix4 sm(t); sm.e(1,1)=sm.e(1,2)=sm.e(1,3)=sm.e(2,1)=sm.e(2,2)=sm.e(2,3)=sm.e(3,1)=sm.e(3,2)=sm.e(3,3)=0; sm+=r; t=sm; } }
Transform::Transform(const Vector3& translation, const Quat4& rotation) : isIdentity(false), isPureTranslationRotation(true), hasTranslation(translation!=Vector3(0,0,0)), hasRotation(!rotation.equals(Quat4())), orient(rotation), trans(translation) {}
Transform::Transform(const Quat4& rotation) : isIdentity(rotation.equals(Quat4())), isPureTranslationRotation(true), hasTranslation(false), hasRotation(!rotation.equals(Quat4())), orient(rotation) {}