MCPcopy Create free account
hub / github.com/TombEngine/TombEngine / GetRelOrientToNormal

Function GetRelOrientToNormal

TombEngine/Math/Geometry.cpp:276–293  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

274 }
275
276 EulerAngles GetRelOrientToNormal(short orient, const Vector3& normal, const Vector3& gravity)
277 {
278 // TODO: Consider axis.
279
280 // Determine relative angle properties of normal.
281 short aspectAngle = Geometry::GetSurfaceAspectAngle(normal);
282 short slopeAngle = Geometry::GetSurfaceSlopeAngle(normal);
283
284 short deltaAngle = Geometry::GetShortestAngle(orient, aspectAngle);
285 float sinDeltaAngle = phd_sin(deltaAngle);
286 float cosDeltaAngle = phd_cos(deltaAngle);
287
288 // Calculate relative orientation adhering to normal.
289 return EulerAngles(
290 -slopeAngle * cosDeltaAngle,
291 orient,
292 slopeAngle * sinDeltaAngle);
293 }
294
295 Quaternion ConvertDirectionToQuat(const Vector3& dir)
296 {

Callers 2

AlignLaraToSurfaceFunction · 0.85
GetFootprintVertexPointsFunction · 0.85

Calls 6

GetSurfaceAspectAngleFunction · 0.85
GetSurfaceSlopeAngleFunction · 0.85
GetShortestAngleFunction · 0.85
phd_sinFunction · 0.85
phd_cosFunction · 0.85
EulerAnglesClass · 0.70

Tested by

no test coverage detected