MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / WorldToLocal

Method WorldToLocal

Source/Engine/Core/Math/Transform.cpp:160–176  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

158}
159
160void Transform::WorldToLocal(const Transform& other, Transform& result) const
161{
162 Vector3 invScale = Scale;
163 if (invScale.X != 0.0f)
164 invScale.X = 1.0f / invScale.X;
165 if (invScale.Y != 0.0f)
166 invScale.Y = 1.0f / invScale.Y;
167 if (invScale.Z != 0.0f)
168 invScale.Z = 1.0f / invScale.Z;
169 const Quaternion invRotation = Orientation.Conjugated();
170 Quaternion::Multiply(invRotation, other.Orientation, result.Orientation);
171 result.Orientation.Normalize();
172 Float3::Multiply(other.Scale, invScale, result.Scale);
173 const Vector3 tmp = other.Translation - Translation;
174 Vector3::Transform(tmp, invRotation, result.Translation);
175 Vector3::Multiply(result.Translation, invScale, result.Translation);
176}
177
178void Transform::WorldToLocal(const Vector3& point, Vector3& result) const
179{

Callers 15

TestWorldToLocalMethod · 0.45
TestMath.cppFile · 0.45
SetNodeTransformMethod · 0.45
CalculateSoundMixMethod · 0.45
ProcessGroupAnimationMethod · 0.45
ContainsMethod · 0.45
IntersectsMethod · 0.45
ContainsMethod · 0.45
IntersectsMethod · 0.45

Calls 5

ConjugatedMethod · 0.80
ConjugateMethod · 0.80
MultiplyFunction · 0.70
TransformClass · 0.70
NormalizeMethod · 0.45

Tested by 2

TestWorldToLocalMethod · 0.36