Documentation ¶
Index ¶
- type Point
- func (p Point[E]) Add(q Point[E]) Point[E]
- func (p Point[E]) Div(k E) Point[E]
- func (p Point[E]) Eq(q Point[E]) bool
- func (p Point[E]) In(r Rectangle[E]) bool
- func (p Point[E]) Mod(r image.Rectangle) image.Point
- func (p Point[E]) Mul(k E) Point[E]
- func (p Point[E]) RoundPoint() image.Point
- func (p Point[E]) String() string
- func (p Point[E]) Sub(q Point[E]) Point[E]
- type Rectangle
- func FromRectInt[E constraints.Number](rect image.Rectangle) Rectangle[E]
- func Rect[E constraints.Number](x0, y0, x1, y1 E) Rectangle[E]
- func ScaleRectangleBySize[E constraints.Integer](rect Rectangle[E], size Point[E], limit Rectangle[E]) Rectangle[E]
- func UnionPoints[E constraints_.Number](pts ...Point[E]) Rectangle[E]
- func UnionRectangles[E constraints_.Number](rs ...Rectangle[E]) Rectangle[E]
- func (r Rectangle[E]) Add(p Point[E]) Rectangle[E]
- func (r Rectangle[E]) At(x, y E) color.Color
- func (r Rectangle[E]) Bounds() Rectangle[E]
- func (r Rectangle[E]) Canon() Rectangle[E]
- func (r Rectangle[E]) ColorModel() color.Model
- func (r Rectangle[E]) Div(k E) Rectangle[E]
- func (r Rectangle[E]) Dx() E
- func (r Rectangle[E]) Dy() E
- func (r Rectangle[E]) Empty() bool
- func (r Rectangle[E]) Eq(s Rectangle[E]) bool
- func (r Rectangle[E]) In(s Rectangle[E]) bool
- func (r Rectangle[E]) Inset(n E) Rectangle[E]
- func (r Rectangle[E]) Intersect(s Rectangle[E]) Rectangle[E]
- func (r Rectangle[E]) Mul(k E) Rectangle[E]
- func (r Rectangle[E]) Overlaps(s Rectangle[E]) bool
- func (r Rectangle[E]) RGBA64At(x, y E) color.RGBA64
- func (r Rectangle[E]) RoundRectangle() image.Rectangle
- func (r Rectangle[E]) ScaleByFactor(factor Point[E]) Rectangle[E]
- func (r Rectangle[E]) Size() Point[E]
- func (r Rectangle[E]) String() string
- func (r Rectangle[E]) Sub(p Point[E]) Rectangle[E]
- func (r Rectangle[E]) Union(s Rectangle[E]) Rectangle[E]
- func (r Rectangle[E]) UnionPoints(pts ...Point[E]) Rectangle[E]
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Point ¶
type Point[E constraints.Number] struct { X, Y E }
A Point is an X, Y coordinate pair. The axes increase right and down.
func ScaleLineSegment ¶
func ScaleLineSegment[E constraints_.Number](segment Point[E], length E, limit Point[E]) Point[E]
ScaleLineSegment segment's size to length flexible in limit
func (Point[E]) Mod ¶
Mod returns the point q in r such that p.X-q.X is a multiple of r's width and p.Y-q.Y is a multiple of r's height.
func (Point[E]) RoundPoint ¶
type Rectangle ¶
type Rectangle[E constraints.Number] struct { Min, Max Point[E] }
func FromRectInt ¶
func FromRectInt[E constraints.Number](rect image.Rectangle) Rectangle[E]
func Rect ¶
func Rect[E constraints.Number](x0, y0, x1, y1 E) Rectangle[E]
Rect is shorthand for Rectangle[E]{Pt(x0, y0), Pt(x1, y1)}. The returned rectangle has minimum and maximum coordinates swapped if necessary so that it is well-formed.
func ScaleRectangleBySize ¶
func ScaleRectangleBySize[E constraints.Integer](rect Rectangle[E], size Point[E], limit Rectangle[E]) Rectangle[E]
ScaleRectangleBySize scale rect to size flexible in limit
func UnionPoints ¶
func UnionPoints[E constraints_.Number](pts ...Point[E]) Rectangle[E]
UnionPoints returns the smallest rectangle that contains all points. an empty rectangle is a empty set, Not a point
func UnionRectangles ¶
func UnionRectangles[E constraints_.Number](rs ...Rectangle[E]) Rectangle[E]
UnionRectangles returns the smallest rectangle that contains all rectangles, empty rectangles excluded.
func (Rectangle[E]) Canon ¶
Canon returns the canonical version of r. The returned rectangle has minimum and maximum coordinates swapped if necessary so that it is well-formed.
func (Rectangle[E]) ColorModel ¶
ColorModel implements the Image interface.
func (Rectangle[E]) Eq ¶
Eq reports whether r and s contain the same set of points. All empty rectangles are considered equal.
func (Rectangle[E]) Inset ¶
Inset returns the rectangle r inset by n, which may be negative. If either of r's dimensions is less than 2*n then an empty rectangle near the center of r will be returned.
func (Rectangle[E]) 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.
func (Rectangle[E]) RoundRectangle ¶
func (Rectangle[E]) ScaleByFactor ¶
ScaleByFactor scale rect to factor*size
func (Rectangle[E]) UnionPoints ¶
UnionPoints returns the smallest rectangle that contains all points.