summaryrefslogtreecommitdiff
path: root/dir.go
blob: 693db987b2e1be65e46a2406184309c51076260e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package mt

// A Dir represents a direction parallel to an axis.
type Dir uint8

const (
	East  Dir = iota // +X
	Above            // +Y
	North            // +Z
	South            // -Z
	Below            // -Y
	West             // -X
	NoDir
)

// Opposite returns the Dir's opposite.
// NoDir is its own opposite.
func (d Dir) Opposite() Dir {
	if d >= NoDir {
		return NoDir
	}
	return 5 - d
}