1
0
Fork 0
go-raytracer/math/direction.go
2025-06-08 15:51:07 +02:00

26 lines
376 B
Go

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)
}