Documentation ¶
Index ¶
- type Matrix
- func (m *Matrix) Angle() float64
- func (m *Matrix) Clone() Matrix
- func (m *Matrix) Concat(b Matrix)
- func (m Matrix) Mult(b Matrix) Matrix
- func (m *Matrix) Rotate(angle float64)
- func (m *Matrix) Scale(x, y float64)
- func (m *Matrix) ScalingFactorX() float64
- func (m *Matrix) ScalingFactorY() float64
- func (m *Matrix) Set(a, b, c, d, tx, ty float64)
- func (m *Matrix) Shear(x, y float64)
- func (m Matrix) String() string
- func (m *Matrix) Transform(x, y float64) (float64, float64)
- func (m *Matrix) Translate(x, y float64)
- func (m *Matrix) Translation() (float64, float64)
- func (m *Matrix) Unrealistic() bool
- type Point
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Matrix ¶
type Matrix [9]float64
Matrix is a linear transform matrix in homogenous coordinates. PDF coordinate transforms are always affine so we only need 6 of these. See newMatrix.
func NewMatrix ¶
NewMatrix returns an affine transform matrix laid out in homogenous coordinates as
a b 0 c d 0 tx ty 1
func RotationMatrix ¶
RotationMatrix returns a matrix that rotates by angle `angle`, specified in radians.
func ScaleMatrix ¶
ScaleMatrix returns a matrix that scales by `x`,`y`.
func ShearMatrix ¶
ShearMatrix returns a matrix that shears `x`,`y`.
func TranslationMatrix ¶
TranslationMatrix returns a matrix that translates by `tx`,`ty`.
func (*Matrix) Angle ¶
Angle returns the angle of the affine transform in `m` in degrees.
func (*Matrix) Concat ¶
Concat sets `m` to `b` × `m`. `b` needs to be created by newMatrix. i.e. It must be an affine transform.
b00 b01 0 m00 m01 0 b00*m00 + b01*m01 b00*m10 + b01*m11 0 b10 b11 0 × m10 m11 0 ➔ b10*m00 + b11*m01 b10*m10 + b11*m11 0 b20 b21 1 m20 m21 1 b20*m00 + b21*m10 + m20 b20*m01 + b21*m11 + m21 1
func (*Matrix) Rotate ¶
Rotate rotates the current matrix by angle `angle`, specified in radians.
func (*Matrix) Scale ¶
Scale scales the current matrix by `x`,`y`.
func (*Matrix) ScalingFactorX ¶
ScalingFactorX returns the X scaling of the affine transform.
func (*Matrix) ScalingFactorY ¶
ScalingFactorY returns the Y scaling of the affine transform.
func (*Matrix) Set ¶
Set sets `m` to affine transform a,b,c,d,tx,ty.
func (*Matrix) Shear ¶
Shear shears the current matrix by `x',`y`.
func (*Matrix) Transform ¶
Transform returns coordinates `x`,`y` transformed by `m`.
func (*Matrix) Translate ¶
Translate appends a translation of `x`,`y` to `m`. m.Translate(dx, dy) is equivalent to m.Concat(NewMatrix(1, 0, 0, 1, dx, dy))
func (*Matrix) Translation ¶
Translation returns the translation part of `m`.
type Point ¶
Point defines a point (X,Y) in Cartesian coordinates.
func (Point) Displace ¶
Displace returns a new Point at location `p` + `delta`.
func (Point) Distance ¶
Distance returns the distance between `a` and `b`.
func (Point) Interpolate ¶
Interpolate does linear interpolation between point `a` and `b` for value `t`.
func (Point) Rotate ¶
Rotate returns a new Point at `p` rotated by `theta` degrees.
func (*Point) Set ¶
Set mutates `p` and sets to coordinates `(x, y)`.