void Quat::Set(const float3x4 &m) { assume(m.IsColOrthogonal()); assume(m.HasUnitaryScale()); assume(!m.HasNegativeScale()); SetQuatFrom(*this, m); #ifdef MATH_ASSERT_CORRECTNESS // Test that the conversion float3x3->Quat->float3x3 is correct. mathassert(this->ToFloat3x3().Equals(m.Float3x3Part(), 0.01f)); #endif }
void Placeable::SetWorldTransform(const float3x4 &tm) { assume(tm.IsColOrthogonal()); assume(!tm.HasNegativeScale()); if (!parentPlaceable_) // No parent, the local->parent transform equals the local->world transform. { SetTransform(tm); return; } float3x4 parentWorldTransform = parentPlaceable_->LocalToWorld(); bool success = parentWorldTransform.Inverse(); if (!success) { if (parentEntity) LogError("Parent for entity " + parentEntity->ToString() + " has an invalid world transform!"); else LogError("Parent for a detached entity has an invalid world transform!"); return; } SetTransform(parentWorldTransform * tm); }
void Placeable::SetTransform(const float3x4 &tm) { assume(tm.IsColOrthogonal()); assume(!tm.HasNegativeScale()); transform.Set(Transform(tm), AttributeChange::Default); }