Difference between revisions of "Matrix"

From Silhouette Wiki
Jump to navigation Jump to search
(Created page with "== Matrix == A Matrix is a 4x4 column-major matrix. === Attributes === ''These attributes are read-only.'' {| class="wikitable" ! scope="col" | Name ! scope="col" class="un...")
 
 
(5 intermediate revisions by the same user not shown)
Line 1: Line 1:
== Matrix ==
 
 
 
A Matrix is a 4x4 column-major matrix.
 
A Matrix is a 4x4 column-major matrix.
  
Line 19: Line 17:
 
! scope="col" | Name
 
! scope="col" | Name
 
! scope="col" class="unsortable" | Description
 
! scope="col" class="unsortable" | Description
 +
! scope="col" | Added
 
|-
 
|-
 
|frustum([[Rect]], near=0.0, far=1.0)
 
|frustum([[Rect]], near=0.0, far=1.0)
 
|Sets to a frustum
 
|Sets to a frustum
 +
|-
 +
|getValue(row, col)
 +
|Returns the value at the specified row and column.
 
|-
 
|-
 
|lookat(eye, center, up)
 
|lookat(eye, center, up)
Line 31: Line 33:
 
|perspective(y_fov, aspect, near=0.0, far=1.0)
 
|perspective(y_fov, aspect, near=0.0, far=1.0)
 
|Sets to a perspective matrix
 
|Sets to a perspective matrix
 +
|-
 +
|rotate(angle, axis=None)
 +
|Rotates the matrix around the axis ([[Point3D]]) or origin by the angle (radians).
 +
|-
 +
|scale(point)
 +
|Scales the matrix by the point ([[Point3D]]).
 +
|-
 +
|scale(x, y, z=1.0)
 +
|Scales the matrix by the x, y, z values.
 +
|-
 +
|setValue(row, col, value)
 +
|Sets the value at the specified row and column.
 +
|-
 +
|shear(point)
 +
|Shears the matrix by the point ([[Point3D]]).
 +
|-
 +
|shear(x, y, z=0.0)
 +
|Shears the matrix by the x, y, z values.
 +
|-
 +
|transform(point)
 +
|Returns the transformed point ([[Point3D]]).
 
|-
 
|-
 
|translate(point)
 
|translate(point)
Line 38: Line 61:
 
|Translates the matrix by the x, y, z values.
 
|Translates the matrix by the x, y, z values.
 
|-
 
|-
|transform(point)
+
|transpose()
|Returns the transformed point ([[Point3D]]).
+
|Returns the transposed matrix.
 +
|6.0
 
|-
 
|-
 
|viewport([[Rect]], near=0.0, far=1.0)
 
|viewport([[Rect]], near=0.0, far=1.0)
Line 45: Line 69:
 
|}
 
|}
  
=== Constants ===
+
=== Math Operators ===
 
 
==== Action Type ====
 
  
 
{| class="wikitable"
 
{| class="wikitable"
! scope="col" | Name
+
! scope="col" | Operator
 +
! scope="col" | Argument
 
! scope="col" class="unsortable" | Description
 
! scope="col" class="unsortable" | Description
 
|-
 
|-
|Action
+
|*
|A normal action that appears in the Actions menu (the default)
+
|[[Point3D]]
 +
|Transforms the Point
 
|-
 
|-
|ShapeImporter
+
|*
|An Action that should appear in the Shape Import menu
+
|[[Matrix]]
 +
|Concatenates the Matrix
 
|-
 
|-
|ShapeExporter
+
|<nowiki>-</nowiki>
|An Action that should appear in the Shape Export menu
+
|
 +
|Returns the inverted Matrix
 
|-
 
|-
|Extension
+
|<nowiki>!</nowiki>
|An Action that implements core functionality is bound using some other means
+
|
 +
|1 if the Matrix is identity, 0 otherwise
 
|}
 
|}

Latest revision as of 14:30, 25 July 2018

A Matrix is a 4x4 column-major matrix.

Attributes

These attributes are read-only.

Name Description
identity True if the Matrix is an identity Matrix

Methods

Name Description Added
frustum(Rect, near=0.0, far=1.0) Sets to a frustum
getValue(row, col) Returns the value at the specified row and column.
lookat(eye, center, up) Sets to a look-at matrix from the eye position to the center using the provided up vector. All three arguments are of type Point3D.
ortho(Rect, near=-1.0, far=1.0) Sets to a orthographic matrix
perspective(y_fov, aspect, near=0.0, far=1.0) Sets to a perspective matrix
rotate(angle, axis=None) Rotates the matrix around the axis (Point3D) or origin by the angle (radians).
scale(point) Scales the matrix by the point (Point3D).
scale(x, y, z=1.0) Scales the matrix by the x, y, z values.
setValue(row, col, value) Sets the value at the specified row and column.
shear(point) Shears the matrix by the point (Point3D).
shear(x, y, z=0.0) Shears the matrix by the x, y, z values.
transform(point) Returns the transformed point (Point3D).
translate(point) Translates the matrix by the point (Point3D).
translate(x, y, z=0.0) Translates the matrix by the x, y, z values.
transpose() Returns the transposed matrix. 6.0
viewport(Rect, near=0.0, far=1.0) Sets to a viewport

Math Operators

Operator Argument Description
* Point3D Transforms the Point
* Matrix Concatenates the Matrix
- Returns the inverted Matrix
! 1 if the Matrix is identity, 0 otherwise