github.com/egonelbre/exp@v0.0.0-20240430123955-ed1d3aa93911/view/geom.go (about) 1 package view 2 3 type Point struct{ X, Y int } 4 type Rectangle struct{ Min, Max Point } 5 6 func Rect(x0, y0, x1, y1 int) Rectangle { 7 if x0 > x1 { 8 x0, x1 = x1, x0 9 } 10 if y0 > y1 { 11 y0, y1 = y1, y0 12 } 13 return Rectangle{Point{x0, y0}, Point{x1, y1}} 14 }