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.

  • #initialize(value) ⇒ Matrix4x4

    Constructs a matrix from a single component value.

  • #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.



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

def initialize(*args)
end

Instance Attribute Details

#m11Float



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

def m11
  @m11
end

#m12Float



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

def m12
  @m12
end

#m13Float



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

def m13
  @m13
end

#m14Float



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

def m14
  @m14
end

#m21Float



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

def m21
  @m21
end

#m22Float



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

def m22
  @m22
end

#m23Float



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

def m23
  @m23
end

#m24Float



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

def m24
  @m24
end

#m31Float



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

def m31
  @m31
end

#m32Float



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

def m32
  @m32
end

#m33Float



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

def m33
  @m33
end

#m34Float



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

def m34
  @m34
end

#m41Float



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

def m41
  @m41
end

#m42Float



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

def m42
  @m42
end

#m43Float



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

def m43
  @m43
end

#m44Float



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

def m44
  @m44
end

#translationVector3



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.



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.



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.



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.



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.



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.



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.



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.



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.



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.



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.



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.



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.



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.



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.



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.



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.



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.



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.



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

def from_yaw_pitch_roll(yaw, pitch, roll)
end

.identityMatrix4x4



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.



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.

  • #*(other) ⇒ Matrix4x4

    Multiplies two matrices together and returns the resulting matrix.



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

def *(other)
end

#**(exponent) ⇒ Matrix4x4

Raises the matrix to the given power.



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.



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.



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

def -(other)
end

#-@Matrix4x4

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



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.



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.



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.



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.

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).



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.

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.



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

def each_row
end

#identity?Boolean



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.



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.

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.

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.

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.

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.

See Also:



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

def row(index)
end

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



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

def to_a
end

#to_hHash{Symbol => Float}



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

def to_h
end

#to_sString



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.



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.



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

def transform!(rotation)
end

#transposeMatrix4x4

Transposes the rows and columns of a matrix.



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

def transpose
end