NSMBW-Decomp
A decompilation of New Super Mario Bros. Wii
Loading...
Searching...
No Matches
trigonometry.hpp
Go to the documentation of this file.
1#pragma once
2#include <types.h>
4/// @file
5
6namespace nw4r {
7namespace math {
8
9/// @brief Computes the sine value.
10/// @param fidx The angle, measured in units of 1/256th of a circle.
11/// @return The sine for fidx.
12float SinFIdx(float fidx);
13
14/// @brief Computes the cosine value.
15/// @param fidx The angle, measured in units of 1/256th of a circle.
16/// @return The cosine for fidx.
17float CosFIdx(float fidx);
18
19/// @brief Computes the sine value.
20/// @param ang The angle, measured in units of 1/65536th of a circle.
21/// @return The sine for idx.
22inline float SinF(float ang) {
23 return SinFIdx(ang * (1.0f / 256.f));
24}
25
26/// @brief Computes the cosine value.
27/// @param ang The angle measured in units of 1/65536th of a circle.
28/// @return The cosine for idx.
29inline float CosF(float ang) {
30 return CosFIdx(ang * (1.0f / 256.f));
31}
32
33/// @brief Computes the sine value.
34/// @param ang The angle, measured in units of 1/65536th of a circle.
35/// @return The sine for idx.
36inline float SinS(short ang) {
37 return SinF(OSu16tof32((u16 *) &ang));
38}
39
40/// @brief Computes the cosine value.
41/// @param ang The angle measured in units of 1/65536th of a circle.
42/// @return The cosine for idx.
43inline float CosS(short ang) {
44 return CosF(OSu16tof32((u16 *) &ang));
45}
46
47} // namespace math
48} // namespace nw4r
float OSu16tof32(register u16 *in)
Converts an unsigned short value into a single-precision floating point value.
Definition OSFastCast.h:21
Math library.
Definition docgroup.h:16
float CosS(short ang)
Computes the cosine value.
float SinS(short ang)
Computes the sine value.
float CosF(float ang)
Computes the cosine value.
float SinFIdx(float fidx)
Computes the sine value.
float SinF(float ang)
Computes the sine value.
float CosFIdx(float fidx)
Computes the cosine value.