// dirnorm returns a normalized direction between two points, so that
// directions that aren't cardinal nor diagonal are transformed into the
// cardinal part (this corresponds to pruned intermediate nodes in diagonal
// jump).
dirnorm returns a normalized direction between two points, so that
directions that aren't cardinal nor diagonal are transformed into the
cardinal part (this corresponds to pruned intermediate nodes in diagonal
jump).
// dirnorm returns a normalized direction between two points so that // directions that aren ' t cardinal nor diagonal are transformed into the // cardinal part ( this corresponds to pruned intermediate nodes in diagonal // jump ) .
func dirnorm(p, q gruid.Point) gruid.Point {
	dir := q.Sub(p)
	dx := abs(dir.X)
	dy := abs(dir.Y)
	dir = gruid.Point{sign(dir.X), sign(dir.Y)}
	switch {
	case dx == dy:
	case dx > dy:
		dir.Y = 0
	default:
		dir.X = 0
	}
	return dir
}
func dirnorm ( p , q gruid . Point ) gruid . Point { dir := q . Sub ( p ) dx := abs ( dir . X ) dy := abs ( dir . Y ) dir = gruid . Point { sign ( dir . X ) , sign ( dir . Y ) } switch { case dx == dy : case dx > dy : dir . Y = 0 default : dir . X = 0 } return dir }
dirnorm returns a normalized direction between two points, so that
directions that aren't cardinal nor diagonal are transformed into the
cardinal part (this corresponds to pruned intermediate nodes in diagonal
jump).
dirnorm returns a normalized direction between two points so that directions that aren ' t cardinal nor diagonal are transformed into the cardinal part ( this corresponds to pruned intermediate nodes in diagonal jump ) .