MCPcopy Create free account
hub / github.com/ZeppelinMC/Zeppelin / YawDirection

Function YawDirection

util/rot.go:20–33  ·  view source on GitHub ↗
(yaw float32)

Source from the content-addressed store, hash-verified

18)
19
20func YawDirection(yaw float32) string {
21 normalizedYaw := NormalizeYaw(yaw)
22 if normalizedYaw >= 315.0 || normalizedYaw < 45.0 {
23 return DirectionPZ // North
24 } else if normalizedYaw >= 45.0 && normalizedYaw < 135.0 {
25 return DirectionPX // East
26 } else if normalizedYaw >= 135.0 && normalizedYaw < 225.0 {
27 return DirectionNZ // South
28 } else if normalizedYaw >= 225.0 && normalizedYaw < 315.0 {
29 return DirectionNX // West
30 }
31
32 return ""
33}
34
35func NormalizeYaw(yaw float32) float32 {
36 yaw = EuclideanRemainder(yaw, 360)

Callers

nothing calls this directly

Calls 1

NormalizeYawFunction · 0.85

Tested by

no test coverage detected