5 // A Pos is a world space position,
6 // represented as a Vec from the origin.
10 func (p Pos) Add(v Vec) Pos {
11 return Pos(Vec(p).Add(v))
15 func (p Pos) Sub(v Vec) Pos {
16 return Pos(Vec(p).Sub(v))
19 // From returns the Vec which moves to p from q.
20 func (p Pos) From(q Pos) Vec {
21 return Vec(p).Sub(Vec(q))
24 // Int returns the position of the node which the Pos is inside.
25 func (p Pos) Int() (ip [3]int16) {
27 ip[i] = int16(math.Round(float64(p[i]) / 10))
32 // IntPos returns the Pos of the node at ip.
33 func IntPos(ip [3]int16) (p Pos) {
35 p[i] = 10 * float32(ip[i])