summaryrefslogtreecommitdiff
path: root/dir.go
blob: e7bb47a5086ab6b19f46c8eaed5fae0fdb87ae02 (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
24
25
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
)

//go:generate stringer -type Dir

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