Initial commit
This commit is contained in:
commit
f26c478727
18 changed files with 621 additions and 0 deletions
26
math/direction.go
Normal file
26
math/direction.go
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
package math
|
||||
|
||||
import (
|
||||
stdmath "math"
|
||||
)
|
||||
|
||||
type Direction float64
|
||||
|
||||
func (d *Direction) Set(v float64) {
|
||||
*d = Direction(v)
|
||||
}
|
||||
|
||||
func (d Direction) Get() float64 {
|
||||
return float64(d)
|
||||
}
|
||||
|
||||
func (d Direction) ForwardVector() Vec2f {
|
||||
return Vec2f{
|
||||
X: stdmath.Cos(float64(d)),
|
||||
Y: stdmath.Sin(float64(d)),
|
||||
}
|
||||
}
|
||||
|
||||
func (d *Direction) Rotate(delta float64) {
|
||||
*d += Direction(delta)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue