class

Draw::Matrix

Inherits Reference < Object

Class methods

from_rects(r1 : StaticArray(Float64, 4), r2 : StaticArray(Float64, 4))

Creates a transformation matrix, combining a scale and a translation, that transform r1 into r2.

Source
identity

Creates an identity transformation matrix.

Source
rotation(angle : Float64)

Creates a rotation transformation matrix. angle is in radian

Source
scale(sx : Float64, sy : Float64)

Creates a transformation matrix with a sx, sy scale factor

Source
translation(tx : Float64, ty : Float64)

Creates a transformation matrix with a translation tx and ty translation parameter

Source

Instance methods

[](i : Int)

Indexes the underlying static array backing a Matrix

Source
compose(m : Draw::Matrix)

Multiplies another matrix to self

Source
determinant

Compute the determinant of the matrix

Source
dup

Copies a matrix

Source
inverse

Computes the matrix inverse

Source
inverse_transform(points : Array(Float64))

Applies the transformation inverse matrix to the rectangle represented by the min and the max point of the rectangle

Source
inverse_transform_point(x : Float64, y : Float64)

Applies the transformation inverse matrix to point. It returns the point the transformed point.

Source
rotate(angle : Float64)

Adds a rotation to the matrix. angle is in radian

Source
scale(sx : Float64, sy : Float64)

Adds a scale to the matrix

Source
scale

Returns the scale of a matrix

Source
scaling

Returns the scaling factors of a matrix

Source
transform(points : Array(Float64))

Applies the transformation matrix to points. It modify the points passed in parameter.

Source
transform_point(x : Float64, y : Float64)

Applies the transformation matrix to point. It returns the point the transformed point.

Source
transform_rectangle(x0 : Float64, y0 : Float64, x2 : Float64, y2 : Float64)

Applies the transformation matrix to the rectangle represented by the min and the max point of the rectangle.

Source
translate(tx : Float64, ty : Float64)

Adds a translation to the matrix

Source
translation

Returns the translation of a matrix

Source
vector_transform(points : Array(Float64))

Applies the transformation matrix to points without using the translation parameter of the affine matrix. It modifies the points passed in parameter.

Source