module Geode::Matrix4x4Transforms3D(T)
Overview
Transformation that can be performed in threedimensions with 4x4 matrices.
These methods produce a new matrix that has the operation performed on it. This:
matrix.rotate_x(45.degrees)
is effectively the same as:
matrix * Matrix4(Float64).rotate_x(45.degrees)
Direct including types
Defined in:
geode/matrices/transforms3d.crInstance Method Summary

#reflect_x : self
Returns a matrix that has a reflection transform applied.

#reflect_y : self
Returns a matrix that has a reflection transform applied.

#reflect_z : self
Returns a matrix that has a reflection transform applied.

#rotate(angle : Number  Angle, axis : CommonVector(U, 3)) : CommonMatrix forall U
Returns a matrix that has a rotation transform applied.

#rotate_x(angle : Number  Angle) : CommonMatrix
Returns a matrix that has a rotation transform applied.

#rotate_y(angle : Number  Angle) : CommonMatrix
Returns a matrix that has a rotation transform applied.

#rotate_z(angle : Number  Angle) : CommonMatrix
Returns a matrix that has a rotation transform applied.

#scale(x, y, z) : CommonMatrix
Returns a matrix that has a scale transform applied.

#scale3(amount : Number) : CommonMatrix
Returns a matrix that has a scale transform applied.

#shear_x(y, z) : CommonMatrix
Returns a matrix that has a shear transform applied.

#shear_y(x, z) : CommonMatrix
Returns a matrix that has a shear transform applied.

#shear_z(x, y) : CommonMatrix
Returns a matrix that has a shear transform applied.

#translate(x, y, z) : CommonMatrix
Returns a matrix with a translation applied.
Instance Method Detail
Returns a matrix that has a reflection transform applied.
Multiplying a 3D object by this matrix will reflect it along the xaxis.
vector = Vector4[1, 2, 3, 1]
matrix = Matrix4(Int32).identity.reflect_x
vector * matrix # => (1, 2, 3, 1)
Returns a matrix that has a reflection transform applied.
Multiplying a 3D object by this matrix will reflect it along the yaxis.
vector = Vector4[1, 2, 3, 1]
matrix = Matrix4(Int32).identity.reflect_y
vector * matrix # => (1, 2, 3, 1)
Returns a matrix that has a reflection transform applied.
Multiplying a 3D object by this matrix will reflect it along the zaxis.
vector = Vector4[1, 2, 3, 1]
matrix = Matrix4(Int32).identity.reflect_z
vector * matrix # => (1, 2, 3, 1)
Returns a matrix that has a rotation transform applied.
The angle must be a Number
in radians or an Angle
.
The object is rotated around the specified axis.
axis = Vector4[1, 1, 1, 0].normalize
vector = Vector4[1, 2, 3, 1]
matrix = Matrix4(Float64).identity.rotate(45.degrees, axis)
vector * matrix # => (1.701141509, 1.183503419, 3.115355072, 1.0)
Returns a matrix that has a rotation transform applied.
Multiplying a 3D object by this matrix will rotate it around the xaxis.
The angle must be a Number
in radians or an Angle
.
vector = Vector4[1, 1, 1, 1]
matrix = Matrix4(Float64).identity.rotate_x(45.degrees)
vector * matrix # => (1.0, 0.0, 1.414213562, 1.0)
Returns a matrix that has a rotation transform applied.
Multiplying a 3D object by this matrix will rotate it around the yaxis.
The angle must be a Number
in radians or an Angle
.
vector = Vector4[1, 1, 1, 1]
matrix = Matrix4(Float64).identity.rotate_y(45.degrees)
vector * matrix # => (1.414213562, 1.0, 0.0, 1.0)
Returns a matrix that has a rotation transform applied.
Multiplying a 3D object by this matrix will rotate it around the zaxis.
The angle must be a Number
in radians or an Angle
.
vector = Vector4[1, 1, 1, 1]
matrix = Matrix4(Float64).identity.rotate_z(45.degrees)
vector * matrix # => (0.0, 1.414213562, 1.0, 1.0)
Returns a matrix that has a scale transform applied.
Nonuniformly scales an object (squash and stretch). Multiplying a 3D object by this matrix will scale it by x amount along the xaxis and y amount along the yaxis. Values for x and y smaller than 1 will shrink it. Values larger than 1 will enlarge it. Negative values will flip it.
vector = Vector4[2, 3, 4, 1]
matrix = Matrix4(Float64).identity.scale(1.5, 2, 2.5)
vector * matrix # => (3.0, 6.0, 9.0, 1.0)
Returns a matrix that has a scale transform applied.
Uniformly scales an object. Multiplying a 3D object by this matrix will scale it by amount. Values for amount smaller than 1 will shrink it. Values larger than 1 will enlarge it. Negative values will flip it.
vector = Vector4[2, 3, 4, 1]
matrix = Matrix4(Int32).identity.scale3(2)
vector * matrix # => (4, 6, 8, 1)
Returns a matrix that has a shear transform applied.
Multiplying a 3D object by this matrix will shear it along the y and zaxis based on the xaxis. For each unit along the xaxis, the y value will be adjusted by y and the z value will be adjusted by z.
vector = Vector4[2, 3, 4, 1]
matrix = Matrix4(Int32).identity.shear_x(2, 3)
vector * matrix # => (2, 7, 10, 1, 1)
Returns a matrix that has a shear transform applied.
Multiplying a 3D object by this matrix will shear it along the x and zaxis based on the yaxis. For each unit along the yaxis, the x value will be adjusted by x and the z value will be adjusted by z.
vector = Vector4[2, 3, 4, 1]
matrix = Matrix4(Int32).identity.shear_y(2, 3)
vector * matrix # => (8, 3, 13, 1)
Returns a matrix that has a shear transform applied.
Multiplying a 3D object by this matrix will shear it along the x and yaxis based on the zaxis. For each unit along the zaxis, the x value will be adjusted by x and the y value will be adjusted by y.
vector = Vector4[2, 3, 4, 1]
matrix = Matrix4(Int32).identity.shear_z(2, 3)
vector * matrix # => (10, 15, 4, 1)
Returns a matrix with a translation applied.
vector = Vector4[3, 5, 7, 1]
matrix = Matrix4(Int32).identity.translate(3, 2, 1)
vector * matrix # => (6, 7, 8, 1)