hue hue hue

This commit is contained in:
2022-08-28 21:39:36 +02:00
parent d1f42d932b
commit e00fe2a4d2
16 changed files with 1300 additions and 77 deletions
+6 -4
View File
@@ -9,9 +9,10 @@ const eps = 0.0001
const epsSquare = eps * eps
type Gamut struct {
Red XY `json:"red"`
Green XY `json:"green"`
Blue XY `json:"blue"`
Label string `json:"label,omitempty"`
Red XY `json:"red"`
Green XY `json:"green"`
Blue XY `json:"blue"`
}
func (cg *Gamut) side(x1, y1, x2, y2, x, y float64) float64 {
@@ -171,7 +172,8 @@ func (xy XY) ToHS() HueSat {
}
func (xy XY) DistanceTo(other XY) float64 {
return math.Sqrt(math.Pow(xy.X-other.X, 2) + math.Pow(xy.Y-other.Y, 2))
return math.Abs(xy.X-other.X) + math.Abs(xy.Y-other.Y)
//return math.Sqrt(math.Pow(xy.X-other.X, 2) + math.Pow(xy.Y-other.Y, 2))
}
func (xy XY) Round() XY {