-
Notifications
You must be signed in to change notification settings - Fork 1
/
mathf.go
33 lines (26 loc) · 805 Bytes
/
mathf.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package linmath
import "math"
func sqrtf(v float32) float32 {
// implemented in assembly on some systems
return float32(math.Sqrt(float64(v)))
}
func sinf(v float32) float32 {
// implemented in assembly on some systems
return float32(math.Sin(float64(v)))
}
func cosf(v float32) float32 {
// implemented in assembly on some systems
return float32(math.Cos(float64(v)))
}
func tanf(v float32) float32 {
// implemented in assembly on some systems
return float32(math.Tan(float64(v)))
}
// DegreesToRadians converts degrees to radians.
func DegreesToRadians(angleDegrees float32) float32 {
return angleDegrees * float32(math.Pi) / 180.0
}
// RadiansToDegrees converts radians to degrees.
func RadiansToDegrees(angleRadians float32) float32 {
return angleRadians * 180.0 / float32(math.Pi)
}