Documentation ¶
Overview ¶
Package f32 is a float32 implementation of package image's Point and Rectangle.
The coordinate space has the origin in the top left corner with the axes extending right and down.
Index ¶
- type Affine2D
- func (a Affine2D) Elems() (sx, hx, ox, hy, sy, oy float32)
- func (a Affine2D) Invert() Affine2D
- func (A Affine2D) Mul(B Affine2D) (r Affine2D)
- func (a Affine2D) Offset(offset Point) Affine2D
- func (a Affine2D) Rotate(origin Point, radians float32) Affine2D
- func (a Affine2D) Scale(origin, factor Point) Affine2D
- func (a Affine2D) Shear(origin Point, radiansX, radiansY float32) Affine2D
- func (a Affine2D) String() string
- func (a Affine2D) Transform(p Point) Point
- type Point
- type Rectangle
- func (r Rectangle) Add(p Point) Rectangle
- func (r Rectangle) Canon() Rectangle
- func (r Rectangle) Dx() float32
- func (r Rectangle) Dy() float32
- func (r Rectangle) Empty() bool
- func (r Rectangle) Intersect(s Rectangle) Rectangle
- func (r Rectangle) Size() Point
- func (r Rectangle) String() string
- func (r Rectangle) Sub(p Point) Rectangle
- func (r Rectangle) Union(s Rectangle) Rectangle
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Affine2D ¶
type Affine2D struct {
// contains filtered or unexported fields
}
Affine2D represents an affine 2D transformation. The zero value if Affine2D represents the identity transform.
func NewAffine2D ¶
NewAffine2D creates a new Affine2D transform from the matrix elements in row major order. The rows are: [sx, hx, ox], [hy, sy, oy], [0, 0, 1].
func (Affine2D) Elems ¶
Elems returns the matrix elements of the transform in row-major order. The rows are: [sx, hx, ox], [hy, sy, oy], [0, 0, 1].
func (Affine2D) Invert ¶
Invert the transformation. Note that if the matrix is close to singular numerical errors may become large or infinity.
func (Affine2D) Rotate ¶
Rotate the transformation by the given angle (in radians) counter clockwise around the given origin.
type Rectangle ¶
type Rectangle struct {
Min, Max Point
}
A Rectangle contains the points (X, Y) where Min.X <= X < Max.X, Min.Y <= Y < Max.Y.
func Rect ¶
Rect is a shorthand for Rectangle{Point{x0, y0}, Point{x1, y1}}. The returned Rectangle has x0 and y0 swapped if necessary so that it's correctly formed.
func (Rectangle) Canon ¶
Canon returns the canonical version of r, where Min is to the upper left of Max.