geagle/Rotation.go

19 lines
270 B
Go

package geagle
import (
"strconv"
"strings"
)
type Rotation string
func (r Rotation) Angle() int {
s := strings.TrimPrefix(string(r), "R")
v, _ := strconv.Atoi(s)
return v
}
func FromAngle(degrees int) Rotation {
return Rotation("R" + strconv.Itoa(degrees))
}