Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Point ¶
type Point struct {
X, Y int
}
A point in 2D space.
var Origin Point
(0,0). Also serves as the zero value for Point in comparisons.
func ChebyEdge ¶
Creates a list of points that have Chebyshev distance == r from (0, 0). The points are ordered, following them will take you from topleft -> bottomleft -> bottomright -> topright.
type Rectangle ¶
type Rectangle struct {
Min, Max Point
}
A rectangle with top-left point Min and top-right point Max, such that it contains points where with Min.X <= p.X < Max.X and Min.Y <= p.Y < Max.Y.
var ZeroRect Rectangle
func Chebyshev ¶
Yields rectangle that contains all coordinates of Chebyshev distance <= r from (0, 0). You can iterate over all points like:
points := Chebyshev(3)
for y := points.Min.Y; y < points.Max.Y; y++ { for x := points.Min.X; x < points.Max.X; x++ { -- do something with Pt(x, y) } }
func (Rectangle) Clip ¶
"Filters" the given list of points into a new list that only contains those points which are contained in r.
func (Rectangle) Intersect ¶
Intersect returns the largest rectangle contained by both r and s. If the two rectangles do not overlap then the zero rectangle will be returned. Stolen from https://golang.org/src/image/geom.go?m=text.