I'm trying to understand a go library for Delaunay triangulation and found out this function to calculate the pseudo angle
Here is the implementation of the psuedo angle
func pseudoAngle(dx, dy float64) float64 {
p := dx / (math.Abs(dx) + math.Abs(dy))
if dy > 0 {
p = (3 - p) / 4
} else {
p = (1 + p) / 4
}
return math.Max(0, math.Min(1-eps, p))
}
Here is were it have been used :
func (t *triangulator) hashKey(point r3.Point) int {
d := point.Sub(t.center)
return int(pseudoAngle(d[0], d[1]) * float64(len(t.hash)))
}
Do you have any idea of where this implementation is coming from mathematically ?