MCPcopy Index your code
hub / github.com/HandmadeMath/HandmadeMath / HMM_Rotate_RH

Function HMM_Rotate_RH

HandmadeMath.h:1921–1946  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1919
1920COVERAGE(HMM_Rotate_RH, 1)
1921static inline HMM_Mat4 HMM_Rotate_RH(float Angle, HMM_Vec3 Axis)
1922{
1923 ASSERT_COVERED(HMM_Rotate_RH);
1924
1925 HMM_Mat4 Result = HMM_M4D(1.0f);
1926
1927 Axis = HMM_NormV3(Axis);
1928
1929 float SinTheta = HMM_SinF(Angle);
1930 float CosTheta = HMM_CosF(Angle);
1931 float CosValue = 1.0f - CosTheta;
1932
1933 Result.Elements[0][0] = (Axis.X * Axis.X * CosValue) + CosTheta;
1934 Result.Elements[0][1] = (Axis.X * Axis.Y * CosValue) + (Axis.Z * SinTheta);
1935 Result.Elements[0][2] = (Axis.X * Axis.Z * CosValue) - (Axis.Y * SinTheta);
1936
1937 Result.Elements[1][0] = (Axis.Y * Axis.X * CosValue) - (Axis.Z * SinTheta);
1938 Result.Elements[1][1] = (Axis.Y * Axis.Y * CosValue) + CosTheta;
1939 Result.Elements[1][2] = (Axis.Y * Axis.Z * CosValue) + (Axis.X * SinTheta);
1940
1941 Result.Elements[2][0] = (Axis.Z * Axis.X * CosValue) + (Axis.Y * SinTheta);
1942 Result.Elements[2][1] = (Axis.Z * Axis.Y * CosValue) - (Axis.X * SinTheta);
1943 Result.Elements[2][2] = (Axis.Z * Axis.Z * CosValue) + CosTheta;
1944
1945 return Result;
1946}
1947
1948COVERAGE(HMM_Rotate_LH, 1)
1949static inline HMM_Mat4 HMM_Rotate_LH(float Angle, HMM_Vec3 Axis)

Callers 4

HMM_Rotate_LHFunction · 0.85
TESTFunction · 0.85
TESTFunction · 0.85
TESTFunction · 0.85

Calls 4

HMM_M4DFunction · 0.85
HMM_NormV3Function · 0.85
HMM_SinFFunction · 0.85
HMM_CosFFunction · 0.85

Tested by

no test coverage detected