@JsType(isNative=true, namespace="Cesium", name="Matrix4") public class Matrix4 extends Object
Modifier and Type | Field and Description |
---|---|
int |
length
Gets the number of items in the collection.
|
static int |
packedLength
The number of elements used to pack the object into an array.
|
Constructor and Description |
---|
Matrix4()
A 4x4 matrix, indexable as a column-major order array.
|
Matrix4(double column0Row0,
double column1Row0,
double column2Row0,
double column3Row0,
double column0Row1,
double column1Row1,
double column2Row1,
double column3Row1,
double column0Row2,
double column1Row2,
double column2Row2,
double column3Row2,
double column0Row3,
double column1Row3,
double column2Row3,
double column3Row3)
A 4x4 matrix, indexable as a column-major order array.
|
Modifier and Type | Method and Description |
---|---|
static Matrix4 |
abs(Matrix4 matrix,
Matrix4 result)
Computes a matrix, which contains the absolute (unsigned) values of the provided matrix's elements.
|
static Matrix4 |
add(Matrix4 left,
Matrix4 right,
Matrix4 result)
Computes the sum of two matrices.
|
Matrix4 |
clone()
Duplicates the provided Matrix4 instance.
|
Matrix4 |
clone(Matrix4 result)
Duplicates the provided Matrix4 instance.
|
static Matrix4 |
clone(Matrix4 matrix,
Matrix4 result)
Duplicates a Matrix4 instance.
|
static int |
COLUMN0ROW0()
The index into Matrix4 for column 0, row 0.
|
static int |
COLUMN0ROW1()
The index into Matrix4 for column 0, row 1.
|
static int |
COLUMN0ROW2()
The index into Matrix4 for column 0, row 2
|
static int |
COLUMN0ROW3()
The index into Matrix4 for column 0, row 3
|
static int |
COLUMN1ROW0()
The index into Matrix4 for column 1, row 0.
|
static int |
COLUMN1ROW1()
The index into Matrix4 for column 1, row 1.
|
static int |
COLUMN1ROW2()
The index into Matrix4 for column 1, row 2.
|
static int |
COLUMN1ROW3()
The index into Matrix4 for column 1, row 3.
|
static int |
COLUMN2ROW0()
The index into Matrix4 for column 2, row 0.
|
static int |
COLUMN2ROW1()
The index into Matrix4 for column 2, row 1.
|
static int |
COLUMN2ROW2()
The index into Matrix4 for column 2, row 2.
|
static int |
COLUMN2ROW3()
The index into Matrix4 for column 2, row 3.
|
static Matrix4 |
computeInfinitePerspectiveOffCenter(double left,
double right,
double bottom,
double top,
double near)
Computes a Matrix4 instance representing an infinite off center perspective transformation.
|
static Matrix4 |
computeInfinitePerspectiveOffCenter(double left,
double right,
double bottom,
double top,
double near,
Matrix4 result)
Computes a Matrix4 instance representing an infinite off center perspective transformation.
|
static Matrix4 |
computeOrthographicOffCenter(double left,
double right,
double bottom,
double top,
double near,
double far)
Computes a Matrix4 instance representing an orthographic transformation matrix.
|
static Matrix4 |
computeOrthographicOffCenter(double left,
double right,
double bottom,
double top,
double near,
double far,
Matrix4 result)
Computes a Matrix4 instance representing an orthographic transformation matrix.
|
static Matrix4 |
computePerspectiveFieldOfView(double fovY,
double aspectRatio,
double near,
double far,
double result)
Computes a Matrix4 instance representing a perspective transformation matrix.
|
static Matrix4 |
computePerspectiveOffCenter(double left,
double right,
double bottom,
double top,
double near,
double far,
Matrix4 result)
Computes a Matrix4 instance representing an off center perspective transformation.
|
static Matrix4 |
computeView(Cartesian3 position,
Cartesian3 direction,
Cartesian3 up,
Cartesian3 right,
Matrix4 result)
Computes a Matrix4 instance that transforms from world space to view space.
|
static Matrix4 |
computeViewportTransformation(Viewport viewport,
double nearDepthRange,
double farDepthRange,
Matrix4 result)
Computes a Matrix4 instance that transforms from normalized device coordinates to window coordinates.
|
boolean |
equals(Matrix4 right)
Compares this matrix to the provided matrix componentwise and returns true if they are equal, false otherwise.
|
static boolean |
equals(Matrix4 left,
Matrix4 right)
Compares the provided matrices componentwise and returns true if they are equal, false otherwise.
|
boolean |
equalsEpsilon(Matrix4 right,
double epsilon)
Compares this matrix to the provided matrix componentwise and returns true if they are within the provided epsilon, false otherwise.
|
static boolean |
equalsEpsilon(Matrix4 left,
Matrix4 right,
double epsilon)
Compares the provided matrices componentwise and returns true if they are within the provided epsilon, false otherwise.
|
static Matrix4 |
fromArray(double[] array)
Creates a Matrix4 from 4 consecutive elements in an array.
|
static Matrix4 |
fromArray(double[] array,
int startingIndex)
Creates a Matrix4 from 4 consecutive elements in an array.
|
static Matrix4 |
fromArray(double[] array,
int startingIndex,
Matrix4 result)
Creates a Matrix4 from 4 consecutive elements in an array.
|
static Matrix4 |
fromCamera(Camera camera)
Computes a Matrix4 instance from a Camera.
|
static Matrix4 |
fromCamera(Camera camera,
Matrix4 result)
Computes a Matrix4 instance from a Camera.
|
static Matrix4 |
fromColumnMajorArray(double[] values)
Creates a Matrix4 instance from a column-major order array.
|
static Matrix4 |
fromColumnMajorArray(double[] values,
Matrix4 result)
Creates a Matrix4 instance from a column-major order array.
|
static Matrix4 |
fromRotationTranslation(Matrix3 rotation)
Computes a Matrix4 instance from a Matrix3 representing the rotation and a Cartesian3 representing the translation.
|
static Matrix4 |
fromRotationTranslation(Matrix3 rotation,
Cartesian3 translation)
Computes a Matrix4 instance from a Matrix3 representing the rotation and a Cartesian3 representing the translation.
|
static Matrix4 |
fromRotationTranslation(Matrix3 rotation,
Cartesian3 translation,
Matrix4 result)
Computes a Matrix4 instance from a Matrix3 representing the rotation and a Cartesian3 representing the translation.
|
static Matrix4 |
fromRowMajorArray(double[] values)
Creates a Matrix4 instance from a row-major order array.
|
static Matrix4 |
fromRowMajorArray(double[] values,
Matrix4 result)
Creates a Matrix4 instance from a row-major order array.
|
static Matrix4 |
fromScale(Cartesian3 scale)
Computes a Matrix4 instance representing a non-uniform scale.
|
static Matrix4 |
fromScale(Cartesian3 scale,
Matrix4 result)
Computes a Matrix4 instance representing a non-uniform scale.
|
static Matrix4 |
fromTranslation(Cartesian3 translation)
Creates a Matrix4 instance from a Cartesian3 representing the translation.
|
static Matrix4 |
fromTranslation(Cartesian3 translation,
Matrix4 result)
Creates a Matrix4 instance from a Cartesian3 representing the translation.
|
static Matrix4 |
fromTranslationQuaternionRotationScale(Cartesian3 translation,
Quaternion rotation,
Cartesian3 scale)
Computes a Matrix4 instance from a translation, rotation, and scale (TRS) representation with the rotation represented as a quaternion.
|
static Matrix4 |
fromTranslationQuaternionRotationScale(Cartesian3 translation,
Quaternion rotation,
Cartesian3 scale,
Matrix4 result)
Computes a Matrix4 instance from a translation, rotation, and scale (TRS) representation with the rotation represented as a quaternion.
|
static Matrix4 |
fromTranslationRotationScale(TranslationRotationScale translationRotationScale)
Creates a Matrix4 instance from a TranslationRotationScale instance.
|
static Matrix4 |
fromTranslationRotationScale(TranslationRotationScale translationRotationScale,
Matrix4 result)
Creates a Matrix4 instance from a TranslationRotationScale instance.
|
static Matrix4 |
fromUniformScale(double scale)
Computes a Matrix4 instance representing a uniform scale.
|
static Matrix4 |
fromUniformScale(double scale,
Matrix4 result)
Computes a Matrix4 instance representing a uniform scale.
|
static Cartesian4 |
getColumn(Matrix4 matrix,
int index,
Cartesian4 result)
Retrieves a copy of the matrix column at the provided index as a Cartesian3 instance.
|
static double |
getElementIndex(int row,
int column)
Computes the array index of the element at the provided row and column.
|
static double |
getMaximumScale(Matrix4 matrix)
Computes the maximum scale assuming the matrix is an affine transformation.
|
static Matrix3 |
getRotation(Matrix4 matrix,
Matrix3 result)
Gets the upper left 3x3 rotation matrix of the provided matrix, assuming the matrix is a affine transformation matrix.
|
static Cartesian4 |
getRow(Matrix4 matrix,
int index,
Cartesian4 result)
Retrieves a copy of the matrix row at the provided index as a Cartesian3 instance.
|
static Cartesian3 |
getScale(Matrix4 matrix,
Cartesian3 result)
Extracts the non-uniform scale assuming the matrix is an affine transformation.
|
static Cartesian3 |
getTranslation(Matrix4 matrix,
Cartesian3 result)
Gets the translation portion of the provided matrix, assuming the matrix is a affine transformation matrix.
|
static Matrix4 |
IDENTITY()
An immutable Matrix4 instance initialized to the identity matrix.
|
static Matrix4 |
inverse(Matrix4 matrix,
Matrix4 result)
Computes the inverse of the provided matrix.
|
static Matrix4 |
inverseTransformation(Matrix4 matrix,
Matrix4 result)
Computes the inverse of the provided matrix assuming it is an affine transformation matrix, where the upper left 3x3
elements are a rotation matrix, and the upper three elements in the fourth column are the translation.
|
static Matrix4 |
multiply(Matrix4 left,
Matrix4 right,
Matrix4 result)
Computes the product of two matrices.
|
static Matrix4 |
multiplyByMatrix3(Matrix4 matrix,
Matrix3 rotation,
Matrix4 result)
Multiplies a transformation matrix (with a bottom row of [0.0, 0.0, 0.0, 1.0]) by a 3x3 rotation matrix.
|
static Cartesian3 |
multiplyByPoint(Matrix4 matrix,
Cartesian3 cartesian,
Cartesian3 result)
Computes the product of a matrix and a Cartesian3.
|
static Cartesian3 |
multiplyByPointAsVector(Matrix4 matrix,
Cartesian3 cartesian,
Cartesian3 result)
Computes the product of a matrix and a Cartesian3.
|
static Matrix4 |
multiplyByScalar(Matrix4 matrix,
double scalar,
Matrix4 result)
Computes the product of a matrix and a scalar.
|
static Matrix4 |
multiplyByScale(Matrix4 matrix,
Cartesian3 scale,
Matrix4 result)
Computes the product of a matrix times a (non-uniform) scale, as if the scale were a scale matrix.
|
static Matrix4 |
multiplyByTranslation(Matrix4 matrix,
Cartesian3 translation,
Matrix4 result)
Multiplies a transformation matrix (with a bottom row of [0.0, 0.0, 0.0, 1.0]) by an implicit translation matrix
defined by a Cartesian3.
|
static Matrix4 |
multiplyByUniformScale(Matrix4 matrix,
double scale,
Matrix4 result)
Multiplies an affine transformation matrix (with a bottom row of [0.0, 0.0, 0.0, 1.0]) by an implicit uniform scale matrix.
|
static Cartesian4 |
multiplyByVector(Matrix4 matrix,
Cartesian4 cartesian,
Cartesian4 result)
Computes the product of a matrix and a column vector.
|
static Matrix4 |
multiplyTransformation(Matrix4 left,
Matrix4 right,
Matrix4 result)
Computes the product of two matrices assuming the matrices are affine transformation matrices,
where the upper left 3x3 elements are a rotation matrix, and the upper three elements in the fourth column are the translation.
|
static Matrix4 |
negate(Matrix4 matrix,
Matrix4 result)
Creates a negated copy of the provided matrix.
|
static double[] |
pack(Matrix4 value,
double[] array)
Stores the provided instance into the provided array.
|
static double[] |
pack(Matrix4 value,
double[] array,
int startingIndex)
Stores the provided instance into the provided array.
|
static Matrix4 |
setColumn(Matrix4 matrix,
int index,
Cartesian4 cartesian,
Matrix4 result)
Computes a new matrix that replaces the specified column in the provided matrix with the provided Cartesian3 instance.
|
static Matrix4 |
setRow(Matrix4 matrix,
int index,
Cartesian4 cartesian,
Matrix4 result)
Computes a new matrix that replaces the specified row in the provided matrix with the provided Cartesian3 instance.
|
static Matrix4 |
setScale(Matrix4 matrix,
Cartesian3 scale,
Matrix4 result)
Computes a new matrix that replaces the scale with the provided scale.
|
static Matrix4 |
setTranslation(Matrix4 matrix,
Cartesian4 translation,
Cartesian4 result)
Computes a new matrix that replaces the translation in the rightmost column of the provided matrix with the provided
translation.
|
static Matrix4 |
subtract(Matrix4 left,
Matrix4 right,
Matrix4 result)
Computes the difference of two matrices.
|
static double[] |
toArray(Matrix4 matrix)
Creates an Array from the provided Matrix4 instance.
|
static double[] |
toArray(Matrix4 matrix,
double[] result)
Creates an Array from the provided Matrix4 instance.
|
String |
toString()
Creates a string representing this Matrix with each row being on a separate line and in the format '(column0, column1)'.
|
static Matrix4 |
transpose(Matrix4 matrix,
Matrix4 result)
Computes the transpose of the provided matrix.
|
static Matrix4 |
unpack(double[] array)
Retrieves an instance from a packed array.
|
static Matrix4 |
unpack(double[] array,
int startingIndex)
Retrieves an instance from a packed array.
|
static Matrix4 |
unpack(double[] array,
int startingIndex,
Matrix4 result)
Retrieves an instance from a packed array.
|
static Matrix4 |
ZERO()
An immutable Matrix4 instance initialized to the zero matrix.
|
@JsProperty public int length
@JsProperty public static int packedLength
@JsConstructor public Matrix4()
@JsConstructor public Matrix4(double column0Row0, double column1Row0, double column2Row0, double column3Row0, double column0Row1, double column1Row1, double column2Row1, double column3Row1, double column0Row2, double column1Row2, double column2Row2, double column3Row2, double column0Row3, double column1Row3, double column2Row3, double column3Row3)
column0Row0
- The value for column 0, row 0. Default: 0.0.column1Row0
- The value for column 1, row 0. Default: 0.0.column2Row0
- The value for column 2, row 0. Default: 0.0.column3Row0
- The value for column 3, row 0. Default: 0.0.column0Row1
- The value for column 0, row 1. Default: 0.0.column1Row1
- The value for column 1, row 1. Default: 0.0.column2Row1
- The value for column 2, row 1. Default: 0.0.column3Row1
- The value for column 3, row 1. Default: 0.0.column0Row2
- The value for column 0, row 2. Default: 0.0.column1Row2
- The value for column 1, row 2. Default: 0.0.column2Row2
- The value for column 2, row 2. Default: 0.0.column3Row2
- The value for column 3, row 2. Default: 0.0.column0Row3
- The value for column 0, row 3. Default: 0.0.column1Row3
- The value for column 1, row 3. Default: 0.0.column2Row3
- The value for column 2, row 3. Default: 0.0.column3Row3
- The value for column 3, row 3. Default: 0.0.fromColumnMajorArray(double[])
,
fromRowMajorArray(double[])
,
fromRotationTranslation(org.cesiumjs.cs.core.Matrix3)
,
fromTranslationRotationScale(org.cesiumjs.cs.core.TranslationRotationScale)
,
fromTranslationQuaternionRotationScale(org.cesiumjs.cs.core.Cartesian3, org.cesiumjs.cs.core.Quaternion, org.cesiumjs.cs.core.Cartesian3)
,
fromTranslation(org.cesiumjs.cs.core.Cartesian3)
,
fromScale(org.cesiumjs.cs.core.Cartesian3)
,
fromUniformScale(double)
,
fromCamera(org.cesiumjs.cs.scene.Camera)
,
computePerspectiveFieldOfView(double, double, double, double, double)
,
computeOrthographicOffCenter(double, double, double, double, double, double)
,
computePerspectiveOffCenter(double, double, double, double, double, double, org.cesiumjs.cs.core.Matrix4)
,
computeInfinitePerspectiveOffCenter(double, double, double, double, double)
,
computeViewportTransformation(org.cesiumjs.cs.core.Viewport, double, double, org.cesiumjs.cs.core.Matrix4)
,
computeView(org.cesiumjs.cs.core.Cartesian3, org.cesiumjs.cs.core.Cartesian3, org.cesiumjs.cs.core.Cartesian3, org.cesiumjs.cs.core.Cartesian3, org.cesiumjs.cs.core.Matrix4)
,
Matrix2
,
Matrix3
,
Packable
@JsProperty(name="COLUMN0ROW0") public static int COLUMN0ROW0()
@JsProperty(name="COLUMN0ROW1") public static int COLUMN0ROW1()
@JsProperty(name="COLUMN0ROW2") public static int COLUMN0ROW2()
@JsProperty(name="COLUMN0ROW3") public static int COLUMN0ROW3()
@JsProperty(name="COLUMN1ROW0") public static int COLUMN1ROW0()
@JsProperty(name="COLUMN1ROW1") public static int COLUMN1ROW1()
@JsProperty(name="COLUMN1ROW2") public static int COLUMN1ROW2()
@JsProperty(name="COLUMN1ROW3") public static int COLUMN1ROW3()
@JsProperty(name="COLUMN2ROW0") public static int COLUMN2ROW0()
@JsProperty(name="COLUMN2ROW1") public static int COLUMN2ROW1()
@JsProperty(name="COLUMN2ROW2") public static int COLUMN2ROW2()
@JsProperty(name="COLUMN2ROW3") public static int COLUMN2ROW3()
@JsProperty(name="IDENTITY") public static Matrix4 IDENTITY()
@JsProperty(name="ZERO") public static Matrix4 ZERO()
@JsMethod public Matrix4 clone()
@JsMethod public Matrix4 clone(Matrix4 result)
result
- The object onto which to store the result.@JsMethod public boolean equals(Matrix4 right)
right
- The right hand side matrix.@JsMethod public boolean equalsEpsilon(Matrix4 right, double epsilon)
right
- The right hand side matrix.epsilon
- The epsilon to use for equality testing.@JsMethod public String toString()
@JsMethod public static Matrix4 abs(Matrix4 matrix, Matrix4 result)
matrix
- The matrix with signed elements.result
- The object onto which to store the result.@JsMethod public static Matrix4 add(Matrix4 left, Matrix4 right, Matrix4 result)
left
- The first matrix.right
- The second matrix.result
- The object onto which to store the result.@JsMethod public static Matrix4 clone(Matrix4 matrix, Matrix4 result)
matrix
- The matrix to duplicate.result
- The object onto which to store the result.@JsMethod public static Matrix4 computeInfinitePerspectiveOffCenter(double left, double right, double bottom, double top, double near)
left
- The number of meters to the left of the camera that will be in view.right
- The number of meters to the right of the camera that will be in view.bottom
- The number of meters below of the camera that will be in view.top
- The number of meters above of the camera that will be in view.near
- The distance to the near plane in meters.@JsMethod public static Matrix4 computeInfinitePerspectiveOffCenter(double left, double right, double bottom, double top, double near, Matrix4 result)
left
- The number of meters to the left of the camera that will be in view.right
- The number of meters to the right of the camera that will be in view.bottom
- The number of meters below of the camera that will be in view.top
- The number of meters above of the camera that will be in view.near
- The distance to the near plane in meters.result
- The object in which the result will be stored.@JsMethod public static Matrix4 computeOrthographicOffCenter(double left, double right, double bottom, double top, double near, double far)
left
- The number of meters to the left of the camera that will be in view.right
- The number of meters to the right of the camera that will be in view.bottom
- The number of meters below of the camera that will be in view.top
- The number of meters above of the camera that will be in view.near
- The distance to the near plane in meters.far
- The distance to the far plane in meters.@JsMethod public static Matrix4 computeOrthographicOffCenter(double left, double right, double bottom, double top, double near, double far, Matrix4 result)
left
- The number of meters to the left of the camera that will be in view.right
- The number of meters to the right of the camera that will be in view.bottom
- The number of meters below of the camera that will be in view.top
- The number of meters above of the camera that will be in view.near
- The distance to the near plane in meters.far
- The distance to the far plane in meters.result
- The object in which the result will be stored.@JsMethod public static Matrix4 computePerspectiveFieldOfView(double fovY, double aspectRatio, double near, double far, double result)
fovY
- The field of view along the Y axis in radians.aspectRatio
- The aspect ratio.near
- The distance to the near plane in meters.far
- The distance to the far plane in meters.result
- The object in which the result will be stored.@JsMethod public static Matrix4 computePerspectiveOffCenter(double left, double right, double bottom, double top, double near, double far, Matrix4 result)
left
- The number of meters to the left of the camera that will be in view.right
- The number of meters to the right of the camera that will be in view.bottom
- The number of meters below of the camera that will be in view.top
- The number of meters above of the camera that will be in view.near
- The distance to the near plane in meters.far
- The distance to the far plane in meters.result
- The object in which the result will be stored.@JsMethod public static Matrix4 computeView(Cartesian3 position, Cartesian3 direction, Cartesian3 up, Cartesian3 right, Matrix4 result)
position
- The position of the camera.direction
- The forward direction.up
- The up direction.right
- The right direction.result
- The object in which the result will be stored.@JsMethod public static Matrix4 computeViewportTransformation(Viewport viewport, double nearDepthRange, double farDepthRange, Matrix4 result)
viewport
- The viewport's corners as shown in Example 1.nearDepthRange
- The near plane distance in window coordinates.farDepthRange
- The far plane distance in window coordinates.result
- The object in which the result will be stored.@JsMethod public static boolean equals(Matrix4 left, Matrix4 right)
left
- The first matrix.right
- The second matrix.@JsMethod public static boolean equalsEpsilon(Matrix4 left, Matrix4 right, double epsilon)
left
- The first matrix.right
- The second matrix.epsilon
- The epsilon to use for equality testing.@JsMethod public static Matrix4 fromArray(double[] array)
// Create the Matrix4:
// [1.0, 2.0, 3.0]
// [1.0, 2.0, 3.0]
// [1.0, 2.0, 3.0]
double[] v = {1.0, 1.0, 1.0, 2.0, 2.0, 2.0, 3.0, 3.0, 3.0};
Matrix4 m = Matrix4.fromArray(v);
// Create same Matrix4 with using an offset into an array
double[] v2 = {0.0, 0.0, 1.0, 1.0, 1.0, 2.0, 2.0, 2.0, 3.0, 3.0, 3.0};
Matrix4 m2 = Matrix4.fromArray(v2, 2);
array
- The array whose 4 consecutive elements correspond to the positions of the matrix. Assumes column-major order.@JsMethod public static Matrix4 fromArray(double[] array, int startingIndex)
// Create the Matrix4:
// [1.0, 2.0, 3.0, 4.0]
// [1.0, 2.0, 3.0, 4.0]
// [1.0, 2.0, 3.0, 4.0]
// [1.0, 2.0, 3.0, 4.0]
double[] v = {1.0, 1.0, 1.0, 1.0, 2.0, 2.0, 2.0, 2.0, 3.0, 3.0, 3.0, 3.0, 4.0, 4.0, 4.0, 4.0};
Matrix4 m = Matrix4.fromArray(v);
// Create same Matrix4 with using an offset into an array
double[] v2 = {0.0, 0.0, 1.0, 1.0, 1.0, 1.0, 2.0, 2.0, 2.0, 2.0, 3.0, 3.0, 3.0, 3.0, 4.0, 4.0, 4.0, 4.0};
Matrix4 m2 = Matrix4.fromArray(v2, 2);
array
- The array whose 4 consecutive elements correspond to the positions of the matrix. Assumes column-major order.startingIndex
- The offset into the array of the first element, which corresponds to first column first row position in the matrix.
Default 0@JsMethod public static Matrix4 fromArray(double[] array, int startingIndex, Matrix4 result)
// Create the Matrix4:
// [1.0, 2.0, 3.0, 4.0]
// [1.0, 2.0, 3.0, 4.0]
// [1.0, 2.0, 3.0, 4.0]
// [1.0, 2.0, 3.0, 4.0]
double[] v = {1.0, 1.0, 1.0, 1.0, 2.0, 2.0, 2.0, 2.0, 3.0, 3.0, 3.0, 3.0, 4.0, 4.0, 4.0, 4.0};
Matrix4 m = Matrix4.fromArray(v);
// Create same Matrix4 with using an offset into an array
double[] v2 = {0.0, 0.0, 1.0, 1.0, 1.0, 1.0, 2.0, 2.0, 2.0, 2.0, 3.0, 3.0, 3.0, 3.0, 4.0, 4.0, 4.0, 4.0};
Matrix4 m2 = Matrix4.fromArray(v2, 2);
array
- The array whose 4 consecutive elements correspond to the positions of the matrix. Assumes column-major order.startingIndex
- The offset into the array of the first element, which corresponds to first column first row position in the matrix.
Default 0result
- The object onto which to store the result.@JsMethod public static Matrix4 fromCamera(Camera camera)
camera
- The camera to use.@JsMethod public static Matrix4 fromCamera(Camera camera, Matrix4 result)
camera
- The camera to use.result
- The object in which the result will be stored, if undefined a new instance will be created.@JsMethod public static Matrix4 fromColumnMajorArray(double[] values)
values
- The column-major order array.@JsMethod public static Matrix4 fromColumnMajorArray(double[] values, Matrix4 result)
values
- The column-major order array.result
- The object in which the result will be stored, if undefined a new instance will be created.@JsMethod public static Matrix4 fromRotationTranslation(Matrix3 rotation)
rotation
- The upper left portion of the matrix representing the rotation.@JsMethod public static Matrix4 fromRotationTranslation(Matrix3 rotation, Cartesian3 translation)
rotation
- The upper left portion of the matrix representing the rotation.translation
- The upper right portion of the matrix representing the translation. Default: Cartesian3.ZERO()
@JsMethod public static Matrix4 fromRotationTranslation(Matrix3 rotation, Cartesian3 translation, Matrix4 result)
rotation
- The upper left portion of the matrix representing the rotation.translation
- The upper right portion of the matrix representing the translation. Default: Cartesian3.ZERO()
result
- The object in which the result will be stored, if undefined a new instance will be created.@JsMethod public static Matrix4 fromRowMajorArray(double[] values)
values
- The row-major order array.@JsMethod public static Matrix4 fromRowMajorArray(double[] values, Matrix4 result)
values
- The row-major order array.result
- The object in which the result will be stored, if undefined a new instance will be created.@JsMethod public static Matrix4 fromScale(Cartesian3 scale)
// Creates
// [7.0, 0.0, 0.0, 0.0]
// [0.0, 8.0, 0.0, 0.0]
// [0.0, 0.0, 9.0, 0.0]
// [0.0, 0.0, 0.0, 1.0]
Matrix4 m = Matrix4.fromScale(new Cartesian3(7.0, 8.0, 9.0));
scale
- The x and y scale factors.@JsMethod public static Matrix4 fromScale(Cartesian3 scale, Matrix4 result)
// Creates
// [7.0, 0.0, 0.0, 0.0]
// [0.0, 8.0, 0.0, 0.0]
// [0.0, 0.0, 9.0, 0.0]
// [0.0, 0.0, 0.0, 1.0]
Matrix4 m = Matrix4.fromScale(new Cartesian3(7.0, 8.0, 9.0));
scale
- The x and y scale factors.result
- The object in which the result will be stored, if undefined a new instance will be created.@JsMethod public static Matrix4 fromTranslation(Cartesian3 translation)
translation
- The upper right portion of the matrix representing the translation.multiplyByTranslation(Matrix4, Cartesian3, Matrix4)
@JsMethod public static Matrix4 fromTranslation(Cartesian3 translation, Matrix4 result)
translation
- The upper right portion of the matrix representing the translation.result
- The object in which the result will be stored, if undefined a new instance will be created.multiplyByTranslation(Matrix4, Cartesian3, Matrix4)
public static Matrix4 fromTranslationQuaternionRotationScale(Cartesian3 translation, Quaternion rotation, Cartesian3 scale)
translation
- The translation transformation.rotation
- The rotation transformation.scale
- The non-uniform scale transformation.public static Matrix4 fromTranslationQuaternionRotationScale(Cartesian3 translation, Quaternion rotation, Cartesian3 scale, Matrix4 result)
translation
- The translation transformation.rotation
- The rotation transformation.scale
- The non-uniform scale transformation.result
- The object in which the result will be stored, if undefined a new instance will be created.@JsMethod public static Matrix4 fromTranslationRotationScale(TranslationRotationScale translationRotationScale)
translationRotationScale
- The instance.@JsMethod public static Matrix4 fromTranslationRotationScale(TranslationRotationScale translationRotationScale, Matrix4 result)
translationRotationScale
- The instance.result
- The object in which the result will be stored, if undefined a new instance will be created.@JsMethod public static Matrix4 fromUniformScale(double scale)
scale
- The uniform scale factor.@JsMethod public static Matrix4 fromUniformScale(double scale, Matrix4 result)
scale
- The uniform scale factor.result
- The object in which the result will be stored, if undefined a new instance will be created.@JsMethod public static Cartesian4 getColumn(Matrix4 matrix, int index, Cartesian4 result)
matrix
- The matrix to use.index
- The zero-based index of the column to retrieve.result
- The object onto which to store the result.@JsMethod public static double getElementIndex(int row, int column)
row
- The zero-based index of the row.column
- The zero-based index of the column.@JsMethod public static double getMaximumScale(Matrix4 matrix)
matrix
- Matrix4 The matrix.@JsMethod public static Matrix3 getRotation(Matrix4 matrix, Matrix3 result)
Example:
// returns a Matrix3 instance from a Matrix4 instance
// m = [10.0, 14.0, 18.0, 22.0]
// [11.0, 15.0, 19.0, 23.0]
// [12.0, 16.0, 20.0, 24.0]
// [13.0, 17.0, 21.0, 25.0]
Matrix4 b = new Matrix4();
Matrix4.getRotation(m,b);
// b = [10.0, 14.0, 18.0]
// [11.0, 15.0, 19.0]
// [12.0, 16.0, 20.0]
matrix
- The matrix to use.result
- The object onto which to store the result.@JsMethod public static Cartesian4 getRow(Matrix4 matrix, int index, Cartesian4 result)
matrix
- The matrix to use.index
- The zero-based index of the row to retrieve.result
- The object onto which to store the result.@JsMethod public static Cartesian3 getScale(Matrix4 matrix, Cartesian3 result)
matrix
- The matrix.result
- The object onto which to store the result.@JsMethod public static Cartesian3 getTranslation(Matrix4 matrix, Cartesian3 result)
matrix
- The matrix to use.result
- The object onto which to store the result.@JsMethod public static Matrix4 inverse(Matrix4 matrix, Matrix4 result)
matrix
- The matrix to invert.result
- The object onto which to store the result.@JsMethod public static Matrix4 inverseTransformation(Matrix4 matrix, Matrix4 result)
matrix
- The matrix to invert.result
- The object onto which to store the result.@JsMethod public static Matrix4 multiply(Matrix4 left, Matrix4 right, Matrix4 result)
left
- The first matrix.right
- The second matrix.result
- The object onto which to store the result.public static Matrix4 multiplyByMatrix3(Matrix4 matrix, Matrix3 rotation, Matrix4 result)
matrix
- The matrix on the left-hand side.rotation
- The 3x3 rotation matrix on the right-hand side.result
- The object onto which to store the result.@JsMethod public static Cartesian3 multiplyByPoint(Matrix4 matrix, Cartesian3 cartesian, Cartesian3 result)
Example:
Cartesian3 p = new Cartesian3(1.0, 2.0, 3.0);
Cartesian3 result = Matrix4.multiplyByPoint(matrix, p, new Cartesian3());
matrix
- The matrix.cartesian
- The point.result
- The object onto which to store the result.@JsMethod public static Cartesian3 multiplyByPointAsVector(Matrix4 matrix, Cartesian3 cartesian, Cartesian3 result)
Example:
Cartesian3 p = new Cartesian3(1.0, 2.0, 3.0);
Cartesian3 result = Matrix4.multiplyByPointAsVector(matrix, p, new Cartesian3());
matrix
- The matrix.cartesian
- The point.result
- The object onto which to store the result.@JsMethod public static Matrix4 multiplyByScalar(Matrix4 matrix, double scalar, Matrix4 result)
matrix
- The matrix.scalar
- The number to multiply by.result
- The object onto which to store the result.@JsMethod public static Matrix4 multiplyByScale(Matrix4 matrix, Cartesian3 scale, Matrix4 result)
Example:
// Instead of Cesium.Matrix4.multiply(m, Cesium.Matrix4.fromScale(scale), m);
Matrix4.multiplyByScale(m, scale, m);
matrix
- The matrix on the left-hand side.scale
- The non-uniform scale on the right-hand side.result
- The object onto which to store the result.fromScale(org.cesiumjs.cs.core.Cartesian3)
,
fromScale(org.cesiumjs.cs.core.Cartesian3, org.cesiumjs.cs.core.Matrix4)
@JsMethod public static Matrix4 multiplyByTranslation(Matrix4 matrix, Cartesian3 translation, Matrix4 result)
Example:
// Instead of Matrix4.multiply(m, Matrix4.fromTranslation(position), m);
Matrix4.multiplyByTranslation(m, position, m);
matrix
- The matrix on the left-hand side.translation
- The translation on the right-hand side.result
- The object onto which to store the result.@JsMethod public static Matrix4 multiplyByUniformScale(Matrix4 matrix, double scale, Matrix4 result)
// Instead of Matrix4.multiply(m, Matrix4.fromUniformScale(scale), m);
Matrix4.multiplyByUniformScale(m, scale, m);
matrix
- The affine matrix on the left-hand side.scale
- The uniform scale on the right-hand side.result
- The object onto which to store the result.fromUniformScale(double)
,
fromUniformScale(double, Matrix4)
,
multiplyByScale(Matrix4, org.cesiumjs.cs.core.Cartesian3, Matrix4)
@JsMethod public static Cartesian4 multiplyByVector(Matrix4 matrix, Cartesian4 cartesian, Cartesian4 result)
matrix
- The matrix.cartesian
- The column.result
- The object onto which to store the result.@JsMethod public static Matrix4 multiplyTransformation(Matrix4 left, Matrix4 right, Matrix4 result)
Matrix4 m1 = new Matrix4(1.0, 6.0, 7.0, 0.0, 2.0, 5.0, 8.0, 0.0, 3.0, 4.0, 9.0, 0.0, 0.0, 0.0, 0.0, 1.0);
var m2 = Transforms.eastNorthUpToFixedFrame(new Cartesian3(1.0, 1.0, 1.0));
Matrix4 m3 = Matrix4.multiplyTransformation(m1, m2, new Matrix4());
left
- The first matrix.right
- The second matrix.result
- The object onto which to store the result.@JsMethod public static Matrix4 negate(Matrix4 matrix, Matrix4 result)
matrix
- The matrix to negate.result
- The object onto which to store the result.@JsMethod public static double[] pack(Matrix4 value, double[] array)
value
- The value to pack.array
- The value to pack.@JsMethod public static double[] pack(Matrix4 value, double[] array, int startingIndex)
value
- The value to pack.array
- The value to pack.startingIndex
- The index into the array at which to start packing the elements. Default: 0@JsMethod public static Matrix4 setColumn(Matrix4 matrix, int index, Cartesian4 cartesian, Matrix4 result)
matrix
- The matrix to use.index
- The zero-based index of the column to set.cartesian
- The Cartesian whose values will be assigned to the specified column.result
- The object onto which to store the result.@JsMethod public static Matrix4 setRow(Matrix4 matrix, int index, Cartesian4 cartesian, Matrix4 result)
matrix
- The matrix to use.index
- The zero-based index of the row to set.cartesian
- The Cartesian whose values will be assigned to the specified row.result
- The object onto which to store the result.@JsMethod public static Matrix4 setScale(Matrix4 matrix, Cartesian3 scale, Matrix4 result)
matrix
- The matrix to use.scale
- The scale that replaces the scale of the provided matrix.result
- The object onto which to store the result.@JsMethod public static Matrix4 setTranslation(Matrix4 matrix, Cartesian4 translation, Cartesian4 result)
matrix
- The matrix to use.translation
- The translation that replaces the translation of the provided matrix.result
- The object onto which to store the result.@JsMethod public static Matrix4 subtract(Matrix4 left, Matrix4 right, Matrix4 result)
left
- The first matrix.right
- The second matrix.result
- The object onto which to store the result.@JsMethod public static double[] toArray(Matrix4 matrix)
matrix
- The matrix to use.@JsMethod public static double[] toArray(Matrix4 matrix, double[] result)
matrix
- The matrix to use.result
- The Array onto which to store the result.@JsMethod public static Matrix4 transpose(Matrix4 matrix, Matrix4 result)
matrix
- The matrix to transpose.result
- The object onto which to store the result.@JsMethod public static Matrix4 unpack(double[] array)
array
- The packed array.@JsMethod public static Matrix4 unpack(double[] array, int startingIndex)
array
- The packed array.startingIndex
- The starting index of the element to be unpacked.@JsMethod public static Matrix4 unpack(double[] array, int startingIndex, Matrix4 result)
array
- The packed array.startingIndex
- The starting index of the element to be unpacked.result
- The object into which to store the result.Copyright © 2019. All rights reserved.