Class: Numerix::Matrix4x4

Inherits:
MatrixBase show all
Defined in:
lib/numerix/matrix4x4.rb

Overview

A structure encapsulating a 4x4 matrix.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Structure

#address, #dup, #each, #pack, #ptr, size, unpack

Constructor Details

#initializeMatrix4x4 #initialize(matrix) ⇒ Matrix4x4 #initialize(value) ⇒ Matrix4x4 #initialize(m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, m41, m42, m43, m44) ⇒ Matrix4x4

Returns a new instance of Matrix4x4.

Overloads:

  • #initializeMatrix4x4

    Constructs a default matrix with all values set to 0.0.

  • #initialize(matrix) ⇒ Matrix4x4

    Constructs a Matrix4x4 from the given Numerix::Matrix3x2.

    Parameters:

    • matrix (Matrix3x3)

      The source matrix.

  • #initialize(value) ⇒ Matrix4x4

    Constructs a matrix from a single component value.

    Parameters:

    • value (Float)

      Value to applied to all components.

  • #initialize(m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, m41, m42, m43, m44) ⇒ Matrix4x4

    Constructs a matrix from the given components.

    Parameters:

    • m11 (Float)

      Value at row 1, column 1 of the matrix.

    • m12 (Float)

      Value at row 1, column 2 of the matrix.

    • m13 (Float)

      Value at row 1, column 3 of the matrix.

    • m14 (Float)

      Value at row 1, column 4 of the matrix.

    • m21 (Float)

      Value at row 2, column 1 of the matrix.

    • m22 (Float)

      Value at row 2, column 2 of the matrix.

    • m23 (Float)

      Value at row 2, column 3 of the matrix.

    • m24 (Float)

      Value at row 2, column 4 of the matrix.

    • m31 (Float)

      Value at row 3, column 1 of the matrix.

    • m32 (Float)

      Value at row 3, column 2 of the matrix.

    • m33 (Float)

      Value at row 3, column 3 of the matrix.

    • m34 (Float)

      Value at row 3, column 4 of the matrix.

    • m41 (Float)

      Value at row 4, column 1 of the matrix.

    • m42 (Float)

      Value at row 4, column 2 of the matrix.

    • m43 (Float)

      Value at row 4, column 3 of the matrix.

    • m44 (Float)

      Value at row 4, column 4 of the matrix.



109
110
# File 'lib/numerix/matrix4x4.rb', line 109

def initialize(*args)
end

Instance Attribute Details

#m11Float

Returns Value at row 1, column 1 of the matrix.

Returns:

  • (Float)

    Value at row 1, column 1 of the matrix.



9
10
11
# File 'lib/numerix/matrix4x4.rb', line 9

def m11
  @m11
end

#m12Float

Returns Value at row 1, column 2 of the matrix.

Returns:

  • (Float)

    Value at row 1, column 2 of the matrix.



13
14
15
# File 'lib/numerix/matrix4x4.rb', line 13

def m12
  @m12
end

#m13Float

Returns Value at row 1, column 3 of the matrix.

Returns:

  • (Float)

    Value at row 1, column 3 of the matrix.



17
18
19
# File 'lib/numerix/matrix4x4.rb', line 17

def m13
  @m13
end

#m14Float

Returns Value at row 1, column 4 of the matrix.

Returns:

  • (Float)

    Value at row 1, column 4 of the matrix.



21
22
23
# File 'lib/numerix/matrix4x4.rb', line 21

def m14
  @m14
end

#m21Float

Returns Value at row 2, column 1 of the matrix.

Returns:

  • (Float)

    Value at row 2, column 1 of the matrix.



25
26
27
# File 'lib/numerix/matrix4x4.rb', line 25

def m21
  @m21
end

#m22Float

Returns Value at row 2, column 2 of the matrix.

Returns:

  • (Float)

    Value at row 2, column 2 of the matrix.



29
30
31
# File 'lib/numerix/matrix4x4.rb', line 29

def m22
  @m22
end

#m23Float

Returns Value at row 2, column 3 of the matrix.

Returns:

  • (Float)

    Value at row 2, column 3 of the matrix.



33
34
35
# File 'lib/numerix/matrix4x4.rb', line 33

def m23
  @m23
end

#m24Float

Returns Value at row 2, column 4 of the matrix.

Returns:

  • (Float)

    Value at row 2, column 4 of the matrix.



37
38
39
# File 'lib/numerix/matrix4x4.rb', line 37

def m24
  @m24
end

#m31Float

Returns Value at row 3, column 1 of the matrix.

Returns:

  • (Float)

    Value at row 3, column 1 of the matrix.



41
42
43
# File 'lib/numerix/matrix4x4.rb', line 41

def m31
  @m31
end

#m32Float

Returns Value at row 3, column 2 of the matrix.

Returns:

  • (Float)

    Value at row 3, column 2 of the matrix.



45
46
47
# File 'lib/numerix/matrix4x4.rb', line 45

def m32
  @m32
end

#m33Float

Returns Value at row 3, column 3 of the matrix.

Returns:

  • (Float)

    Value at row 3, column 3 of the matrix.



49
50
51
# File 'lib/numerix/matrix4x4.rb', line 49

def m33
  @m33
end

#m34Float

Returns Value at row 3, column 4 of the matrix.

Returns:

  • (Float)

    Value at row 3, column 4 of the matrix.



53
54
55
# File 'lib/numerix/matrix4x4.rb', line 53

def m34
  @m34
end

#m41Float

Returns Value at row 4, column 1 of the matrix.

Returns:

  • (Float)

    Value at row 4, column 1 of the matrix.



57
58
59
# File 'lib/numerix/matrix4x4.rb', line 57

def m41
  @m41
end

#m42Float

Returns Value at row 4, column 2 of the matrix.

Returns:

  • (Float)

    Value at row 4, column 2 of the matrix.



61
62
63
# File 'lib/numerix/matrix4x4.rb', line 61

def m42
  @m42
end

#m43Float

Returns Value at row 4, column 3 of the matrix.

Returns:

  • (Float)

    Value at row 4, column 3 of the matrix.



65
66
67
# File 'lib/numerix/matrix4x4.rb', line 65

def m43
  @m43
end

#m44Float

Returns Value at row 4, column 4 of the matrix.

Returns:

  • (Float)

    Value at row 4, column 4 of the matrix.



69
70
71
# File 'lib/numerix/matrix4x4.rb', line 69

def m44
  @m44
end

#translationVector3

Returns the translation component of this matrix.

Returns:

  • (Vector3)

    the translation component of this matrix.



73
74
75
# File 'lib/numerix/matrix4x4.rb', line 73

def translation
  @translation
end

Class Method Details

.create_billboard(position, camera, up, forward) ⇒ Matrix4x4

Creates a spherical billboard that rotates around a specified object position.

Parameters:

  • position (Vector3)

    Position of the object the billboard will rotate around.

  • camera (Vector3)

    Position of the camera.

  • up (Vector3)

    The up vector of the camera.

  • forward (Vector3)

    The forward vector of the camera.

Returns:

  • (Matrix4x4)

    the created billboard matrix.



396
397
# File 'lib/numerix/matrix4x4.rb', line 396

def create_billboard(position, camera, up, forward)
end

.create_constrained_billboard(position, camera, axis, cam_forward, obj_forward) ⇒ Matrix4x4

Creates a cylindrical billboard that rotates around a specified axis.

Parameters:

  • position (Vector3)

    Position of the object the billboard will rotate around.

  • camera (Vector3)

    Position of the camera.

  • axis (Vector3)

    Axis to rotate the billboard around.

  • cam_forward (Vector3)

    Forward vector of the camera.

  • obj_forward (Vector3)

    Forward vector of the object.

Returns:

  • (Matrix4x4)

    the created billboard matrix.



410
411
# File 'lib/numerix/matrix4x4.rb', line 410

def create_constrained_billboard(position, camera, axis, cam_forward, obj_forward)
end

.create_look_at(camera, target, up) ⇒ Matrix4x4

Creates a view matrix.

Parameters:

  • camera (Vector3)

    The position of the camera.

  • target (Vector3)

    The target towards which the camera is pointing.

  • up (Vector3)

    The direction that is "up" from the camera's point of view.

Returns:



591
592
# File 'lib/numerix/matrix4x4.rb', line 591

def create_look_at(camera, target, up)
end

.create_orthographic(width, height, near, far) ⇒ Matrix4x4

Creates an orthographic perspective matrix from the given view volume dimensions.

Parameters:

  • width (Float)

    Width of the view volume.

  • height (Float)

    Height of the view volume.

  • near (Float)

    Minimum Z-value of the view volume.

  • far (Float)

    Maximum Z-value of the view volume.

Returns:

  • (Matrix4x4)

    the orthographic projection matrix.



565
566
# File 'lib/numerix/matrix4x4.rb', line 565

def create_orthographic(width, height, near, far)
end

.create_orthographic_off_center(left, right, bottom, top, near, far) ⇒ Matrix4x4

Builds a customized, orthographic projection matrix.

Parameters:

  • left (Float)

    Minimum X-value of the view volume.

  • right (Float)

    Maximum X-value of the view volume.

  • bottom (Float)

    Minimum Y-value of the view volume.

  • top (Float)

    Maximum Y-value of the view volume.

  • near (Float)

    Minimum Z-value of the view volume.

  • far (Float)

    Maximum Z-value of the view volume.

Returns:

  • (Matrix4x4)

    the orthographic projection matrix.



579
580
# File 'lib/numerix/matrix4x4.rb', line 579

def create_orthographic_off_center(left, right, bottom, top, near, far)
end

.create_perspective(width, height, near, far) ⇒ Vector3

Creates a perspective projection matrix from the given view volume dimensions.

Parameters:

  • width (Float)

    Width of the view volume at the near view plane.

  • height (Float)

    Height of the view volume at the near view plane.

  • near (Float)

    Distance to the near view plane.

  • far (Float)

    Distance to the far view plane.

Returns:

  • (Vector3)

    the perspective projection matrix.



534
535
# File 'lib/numerix/matrix4x4.rb', line 534

def create_perspective(width, height, near, far)
end

.create_perspective_fov(fov, ratio, near, far) ⇒ Vector3

Creates a perspective projection matrix based on a field of view, aspect ratio, and near and far view plane distances.

Parameters:

  • fov (Float)

    Field of view in the y direction, in radians.

  • ratio (Float)

    Aspect ratio, defined as view space width divided by height.

  • near (Float)

    Distance to the near view plane.

  • far (Float)

    Distance to the far view plane.

Returns:

  • (Vector3)

    the perspective projection matrix.



521
522
# File 'lib/numerix/matrix4x4.rb', line 521

def create_perspective_fov(fov, ratio, near, far)
end

.create_perspective_off_center(left, right, bottom, top, near, far) ⇒ Vector3

Creates a customized, perspective projection matrix.

Parameters:

  • left (Float)

    Minimum x-value of the view volume at the near view plane.

  • right (Float)

    Maximum x-value of the view volume at the near view plane.

  • bottom (Float)

    Minimum y-value of the view volume at the near view plane.

  • top (Float)

    Maximum y-value of the view volume at the near view plane.

  • near (Float)

    Distance to the near view plane.

  • far (Float)

    Distance to the far view plane.

Returns:

  • (Vector3)

    the perspective projection matrix.



552
553
# File 'lib/numerix/matrix4x4.rb', line 552

def create_perspective_off_center(left, right, bottom, top, near, far)
end

.create_reflection(plane) ⇒ Matrix4x4

Creates a Matrix that reflects the coordinate system about a specified plane.

Parameters:

  • plane (Plane)

    The plane about which to create a reflection.

Returns:

  • (Matrix4x4)

    a new matrix expressing the reflection.



628
629
# File 'lib/numerix/matrix4x4.rb', line 628

def create_reflection(plane)
end

.create_rotation_x(radians) ⇒ Matrix4x4 .create_rotation_x(radians, center) ⇒ Matrix4x4

Creates a matrix for rotating points around the X-axis.

Overloads:

  • .create_rotation_x(radians) ⇒ Matrix4x4

    Parameters:

    • radians (Float)

      The amount, in radians, by which to rotate around the X-axis.

  • .create_rotation_x(radians, center) ⇒ Matrix4x4

    Parameters:

    • radians (Float)

      The amount, in radians, by which to rotate around the X-axis.

    • center (Vector3)

      The center point.

Returns:



475
476
# File 'lib/numerix/matrix4x4.rb', line 475

def create_rotation_x
end

.create_rotation_y(radians) ⇒ Matrix4x4 .create_rotation_y(radians, center) ⇒ Matrix4x4

Creates a matrix for rotating points around the Y-axis.

Overloads:

  • .create_rotation_y(radians) ⇒ Matrix4x4

    Parameters:

    • radians (Float)

      The amount, in radians, by which to rotate around the Y-axis.

  • .create_rotation_y(radians, center) ⇒ Matrix4x4

    Parameters:

    • radians (Float)

      The amount, in radians, by which to rotate around the Y-axis.

    • center (Vector3)

      The center point.

Returns:



491
492
# File 'lib/numerix/matrix4x4.rb', line 491

def create_rotation_y
end

.create_rotation_z(radians) ⇒ Matrix4x4 .create_rotation_z(radians, center) ⇒ Matrix4x4

Creates a matrix for rotating points around the Z-axis.

Overloads:

  • .create_rotation_z(radians) ⇒ Matrix4x4

    Parameters:

    • radians (Float)

      The amount, in radians, by which to rotate around the Z-axis.

  • .create_rotation_z(radians, center) ⇒ Matrix4x4

    Parameters:

    • radians (Float)

      The amount, in radians, by which to rotate around the Z-axis.

    • center (Vector3)

      The center point.

Returns:



507
508
# File 'lib/numerix/matrix4x4.rb', line 507

def create_rotation_z
end

.create_scale(x, y, z) ⇒ Matrix4x4 .create_scale(x, y, z, center) ⇒ Matrix4x4 .create_scale(scales) ⇒ Matrix4x4 .create_scale(scales, center) ⇒ Matrix4x4 .create_scale(scale) ⇒ Matrix4x4 .create_scale(scale, center) ⇒ Matrix4x4

Creates a scaling matrix.

Overloads:

  • .create_scale(x, y, z) ⇒ Matrix4x4

    Parameters:

    • x (Float)

      Value to scale by on the X-axis.

    • y (Float)

      Value to scale by on the Y-axis.

    • z (Float)

      Value to scale by on the Z-axis.

  • .create_scale(x, y, z, center) ⇒ Matrix4x4

    Parameters:

    • x (Float)

      Value to scale by on the X-axis.

    • y (Float)

      Value to scale by on the Y-axis.

    • z (Float)

      Value to scale by on the Z-axis.

    • center (Vector3)

      The center point.

  • .create_scale(scales) ⇒ Matrix4x4

    Parameters:

    • scales (Vector3)

      The vector containing the amount to scale by on each axis.

  • .create_scale(scales, center) ⇒ Matrix4x4

    Parameters:

    • scales (Vector3)

      The vector containing the amount to scale by on each axis.

    • center (Vector3)

      The center point.

  • .create_scale(scale) ⇒ Matrix4x4

    Parameters:

    • scale (Float)

      The uniform scaling factor.

  • .create_scale(scale, center) ⇒ Matrix4x4

    Parameters:

    • scale (Float)

      The uniform scaling factor.

    • center (Vector3)

      The center point.

Returns:



459
460
# File 'lib/numerix/matrix4x4.rb', line 459

def create_scale
end

.create_shadow(direction, plane) ⇒ Matrix4x4

Creates a Matrix that flattens geometry into a specified Plane as if casting a shadow from a specified light source.

Parameters:

  • direction (Vector3)

    The direction from which the light that will cast the shadow is coming.

  • plane (Plane)

    he Plane onto which the new matrix should flatten geometry so as to cast a shadow.

Returns:

  • (Matrix4x4)

    A new Matrix that can be used to flatten geometry onto the specified plane from the specified direction.



618
619
# File 'lib/numerix/matrix4x4.rb', line 618

def create_shadow(direction, plane)
end

.create_translation(position) ⇒ Matrix4x4 .create_translation(x, y, z) ⇒ Matrix4x4

Creates a translation matrix.

Overloads:

  • .create_translation(position) ⇒ Matrix4x4

    Parameters:

    • position (Vector3)

      The amount to translate in each axis.

  • .create_translation(x, y, z) ⇒ Matrix4x4

    Parameters:

    • x (Float)

      The amount to translate on the X-axis.

    • y (Float)

      The amount to translate on the Y-axis.

    • z (Float)

      The amount to translate on the Z-axis.

Returns:



425
426
# File 'lib/numerix/matrix4x4.rb', line 425

def create_translation
end

.create_world(position, forward, up) ⇒ Matrix4x4

Creates a world matrix with the specified parameters.

Parameters:

  • position (Vector3)

    The position of the object; used in translation operations.

  • forward (Vector3)

    Forward direction of the object.

  • up (Vector3)

    Upward direction of the object; usually <0.0, 1.0, 0.0>.

Returns:



604
605
# File 'lib/numerix/matrix4x4.rb', line 604

def create_world(position, forward, up)
end

.from_axis_angle(axis, angle) ⇒ Matrix4x4

Creates a matrix that rotates around an arbitrary vector.

Parameters:

  • axis (Vector3)

    The axis to rotate around.

  • angle (Float)

    The angle to rotate around the given axis, in radians.

Returns:



639
640
# File 'lib/numerix/matrix4x4.rb', line 639

def from_axis_angle(axis, angle)
end

.from_quaternion(quaternion) ⇒ Matrix4x4

Creates a rotation matrix from the given quaternion rotation value.

Parameters:

  • quaternion (Quaternion)

    The source quaternion.

Returns:



648
649
# File 'lib/numerix/matrix4x4.rb', line 648

def from_quaternion(quaternion)
end

.from_yaw_pitch_roll(yaw, pitch, roll) ⇒ Matrix4x4

Creates a rotation matrix from the specified yaw, pitch, and roll.

Parameters:

  • yaw (Float)

    Angle of rotation, in radians, around the Y-axis.

  • pitch (Float)

    Angle of rotation, in radians, around the X-axis.

  • roll (Float)

    Angle of rotation, in radians, around the Z-axis.

Returns:



659
660
# File 'lib/numerix/matrix4x4.rb', line 659

def from_yaw_pitch_roll(yaw, pitch, roll)
end

.identityMatrix4x4

Returns the multiplicative identity matrix.

Returns:

  • (Matrix4x4)

    the multiplicative identity matrix.



382
383
# File 'lib/numerix/matrix4x4.rb', line 382

def identity
end

.lerp(matrix1, matrix2, amount) ⇒ Matrix4x4

Linearly interpolates from matrix1 to matrix2, based on the third parameter.

Parameters:

  • matrix1 (Matrix4x4)

    The first source matrix.

  • matrix2 (Matrix4x4)

    The second source matrix.

  • amount (Float)

    The relative weighting of matrix2, clamped between 0.0 and 1.0.

Returns:



672
673
# File 'lib/numerix/matrix4x4.rb', line 672

def lerp(matrix1, matrix2, amount)
end

Instance Method Details

#*(scalar) ⇒ Matrix4x4 #*(other) ⇒ Matrix4x4

Multiplies this matrix by the specified value.

Overloads:

  • #*(scalar) ⇒ Matrix4x4

    Scales all elements in a matrix by the given scalar factor.

    Parameters:

    • scalar (Float)

      The scaling value to use.

  • #*(other) ⇒ Matrix4x4

    Multiplies two matrices together and returns the resulting matrix.

    Parameters:

    • other (Matrix4x4)

      The source matrix to multiply.

Returns:



308
309
# File 'lib/numerix/matrix4x4.rb', line 308

def *(other)
end

#**(exponent) ⇒ Matrix4x4

Raises the matrix to the given power.

Parameters:

  • exponent (Float)

    The power to raise the matrix to.

Returns:

  • (Matrix4x4)

    New matrix that is result of the operation.



153
154
# File 'lib/numerix/matrix4x4.rb', line 153

def **(exponent)
end

#+(other) ⇒ Matrix4x4

Adds each matrix element in value1 with its corresponding element in the specified matrix.

Parameters:

Returns:

  • (Matrix4x4)

    A matrix containing the summed values.



280
281
# File 'lib/numerix/matrix4x4.rb', line 280

def +(other)
end

#-(other) ⇒ Matrix4x4

Subtracts each matrix element in the specified matrix from its corresponding element in this matrix to form a new matrix of the difference.

Parameters:

  • other (Matrix4x4)

    The matrix to subtract.

Returns:

  • (Matrix4x4)

    The matrix containing the resulting values.



291
292
# File 'lib/numerix/matrix4x4.rb', line 291

def -(other)
end

#-@Matrix4x4

Negates the given matrix by multiplying all values by -1.0.

Returns:



270
271
# File 'lib/numerix/matrix4x4.rb', line 270

def -@
end

#==(other) ⇒ Boolean

Returns flag if this matrix instance is equal to the given object.

Parameters:

  • other (Object)

    The object to compare.

Returns:

  • (Boolean)

    true if objects are equal, otherwise false.



317
318
# File 'lib/numerix/matrix4x4.rb', line 317

def ==(other)
end

#[](row, column) ⇒ Float?

Accesses the matrix component using the zero-based row/column indices.

Parameters:

  • row (Integer)

    The zero-based row index.

  • column (Integer)

    The zero-based column index.

Returns:

  • (Float, nil)

    the value at the specified location, or nil if an index is out of range.



328
329
# File 'lib/numerix/matrix4x4.rb', line 328

def [](row, column)
end

#[]=(row, column, value) ⇒ Float

Sets the matrix component using the zero-based row/column indices.

Parameters:

  • row (Integer)

    The zero-based row index.

  • column (Integer)

    The zero-based column index.

  • value (Float)

    The value to set.

Returns:

  • (Float)

    the value.



339
340
# File 'lib/numerix/matrix4x4.rb', line 339

def []=(row, column, value)
end

#column(index) ⇒ Array<Float>?

Returns the specified matrix column as an array.

Parameters:

  • index (Integer)

    The column index to retrieve.

Returns:

  • (Array<Float>, nil)

    the requested column, or nil if index is out of range.

See Also:



193
194
# File 'lib/numerix/matrix4x4.rb', line 193

def column(index)
end

#determinantFloat

Calculates the determinant for this matrix.

The determinant is calculated by expanding the matrix with a third column whose values are (0,0,1).

Returns:

  • (Float)

    the determinant.



169
170
# File 'lib/numerix/matrix4x4.rb', line 169

def determinant
end

#each_column {|column| ... } ⇒ self

Enumerates the columns of the matrix.

Yields:

  • (column)

    Yields a column to the block.

Yield Parameters:

  • column (Array<Float>)

    The current column as an array.

Returns:

  • (self)

See Also:



217
218
# File 'lib/numerix/matrix4x4.rb', line 217

def each_column
end

#each_row {|row| ... } ⇒ self

Enumerates the rows of the matrix.

see each_column

Yields:

  • (row)

    Yields a row to the block.

Yield Parameters:

  • row (Array<Float>)

    The current row as an array.

Returns:

  • (self)


205
206
# File 'lib/numerix/matrix4x4.rb', line 205

def each_row
end

#identity?Boolean

Returns true if the matrix is the identity matrix, otherwise false.

Returns:

  • (Boolean)

    true if the matrix is the identity matrix, otherwise false.



159
160
# File 'lib/numerix/matrix4x4.rb', line 159

def identity?
end

#invertMatrix4x4

Note:

Some matrices cannot be inverted, in which case the returned matrix will have all values set to NaN.

Attempts to invert the given matrix.

Returns:

  • (Matrix4x4)

    A new matrix that is this matrix inverted.



349
350
# File 'lib/numerix/matrix4x4.rb', line 349

def invert
end

#lerp(matrix, amount) ⇒ Matrix4x4

Linearly interpolates from this matrix to another, based on the amount.

Parameters:

  • matrix (Matrix4x4)

    The source matrix to interpolate between.

  • amount (Float)

    The relative weighting of the given matrix, clamped between 0.0 and 1.0.

Returns:

  • (Matrix4x4)

    a newly created interpolated matrix.

See Also:



230
231
# File 'lib/numerix/matrix4x4.rb', line 230

def lerp(matrix, amount)
end

#lerp!(matrix, amount) ⇒ self

Note:

This method is the same as #lerp, but alters the values of this matrix instead of creating a new instance.

Linearly interpolates from this matrix to another, based on the amount.

Parameters:

  • matrix (Matrix4x4)

    The source matrix to interpolate between.

  • amount (Float)

    The relative weighting of the given matrix, clamped between 0.0 and 1.0.

Returns:

  • (self)

See Also:



246
247
# File 'lib/numerix/matrix4x4.rb', line 246

def lerp!(matrix, amount)
end

#map {|component| ... } ⇒ Matrix4x4 Also known as: collect

The equivalent of Enumerable#map, but returns a matrix object instead of an Array.

Invokes the given block once for each element of self.

Creates a new matrix containing the values returned by the block.

Yields:

  • (component)

    Yields a component of the matrix to the block.

Yield Parameters:

  • component (Float)

    The yielded component.

Returns:

See Also:



126
127
# File 'lib/numerix/matrix4x4.rb', line 126

def map
end

#map! {|component| ... } ⇒ self Also known as: collect!

Invokes the given block once for each element of self, replacing the element with the value returned by the block.

The values of the matrix are altered without creating a ne object.

Yields:

  • (component)

    Yields a component of the matrix to the block.

Yield Parameters:

  • component (Float)

    The yielded component.

Returns:

  • (self)

See Also:



141
142
# File 'lib/numerix/matrix4x4.rb', line 141

def map!
end

#row(index) ⇒ Array<Float>?

Returns the specified matrix row as an array.

Parameters:

  • index (Integer)

    The row index to retrieve.

Returns:

  • (Array<Float>, nil)

    the requested row, or nil if index is out of range.

See Also:



181
182
# File 'lib/numerix/matrix4x4.rb', line 181

def row(index)
end

#to_aArray<Array<Float>> Also known as: elements

Returns an Array representation of this instance.

Returns:

  • (Array<Array<Float>>)

    an Array representation of this instance.



256
257
# File 'lib/numerix/matrix4x4.rb', line 256

def to_a
end

#to_hHash{Symbol => Float}

Returns a Hash representation of this instance.

Returns:

  • (Hash{Symbol => Float})

    a Hash representation of this instance.



263
264
# File 'lib/numerix/matrix4x4.rb', line 263

def to_h
end

#to_sString

Returns a String representation of this instance.

Returns:

  • (String)

    a String representation of this instance.



251
252
# File 'lib/numerix/matrix4x4.rb', line 251

def to_s
end

#transform(rotation) ⇒ Matrix4x4

Creates a matrix by transforming this instance by applying the given quaternion rotation.

Parameters:

  • rotation (Quaternion)

    The rotation to apply.

Returns:



359
360
# File 'lib/numerix/matrix4x4.rb', line 359

def transform(rotation)
end

#transform!(rotation) ⇒ self

Transforms this matrix by applying the given quaternion rotation.

Parameters:

  • rotation (Quaternion)

    The rotation to apply.

Returns:

  • (self)


368
369
# File 'lib/numerix/matrix4x4.rb', line 368

def transform!(rotation)
end

#transposeMatrix4x4

Transposes the rows and columns of a matrix.

Returns:



375
376
# File 'lib/numerix/matrix4x4.rb', line 375

def transpose
end