Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 13 additions & 9 deletions src/math/Matrix2.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,19 @@
*/
export class Matrix2 {

static {

/**
* This flag can be used for type testing.
*
* @type {boolean}
* @readonly
* @default true
*/
Matrix2.prototype.isMatrix2 = true;

}

/**
* Constructs a new 2x2 matrix. The arguments are supposed to be
* in row-major order. If no arguments are provided, the constructor
Expand All @@ -38,15 +51,6 @@ export class Matrix2 {
*/
constructor( n11, n12, n21, n22 ) {

/**
* This flag can be used for type testing.
*
* @type {boolean}
* @readonly
* @default true
*/
Matrix2.prototype.isMatrix2 = true;

/**
* A column-major list of matrix values.
*
Expand Down
22 changes: 13 additions & 9 deletions src/math/Matrix3.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,19 @@
*/
class Matrix3 {

static {

/**
* This flag can be used for type testing.
*
* @type {boolean}
* @readonly
* @default true
*/
Matrix3.prototype.isMatrix3 = true;

}

/**
* Constructs a new 3x3 matrix. The arguments are supposed to be
* in row-major order. If no arguments are provided, the constructor
Expand All @@ -45,15 +58,6 @@ class Matrix3 {
*/
constructor( n11, n12, n13, n21, n22, n23, n31, n32, n33 ) {

/**
* This flag can be used for type testing.
*
* @type {boolean}
* @readonly
* @default true
*/
Matrix3.prototype.isMatrix3 = true;

/**
* A column-major list of matrix values.
*
Expand Down
22 changes: 13 additions & 9 deletions src/math/Matrix4.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,19 @@ import { Vector3 } from './Vector3.js';
*/
class Matrix4 {

static {

/**
* This flag can be used for type testing.
*
* @type {boolean}
* @readonly
* @default true
*/
Matrix4.prototype.isMatrix4 = true;

}

/**
* Constructs a new 4x4 matrix. The arguments are supposed to be
* in row-major order. If no arguments are provided, the constructor
Expand All @@ -65,15 +78,6 @@ class Matrix4 {
*/
constructor( n11, n12, n13, n14, n21, n22, n23, n24, n31, n32, n33, n34, n41, n42, n43, n44 ) {

/**
* This flag can be used for type testing.
*
* @type {boolean}
* @readonly
* @default true
*/
Matrix4.prototype.isMatrix4 = true;

/**
* A column-major list of matrix values.
*
Expand Down
18 changes: 11 additions & 7 deletions src/math/Vector2.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,7 @@ import { clamp } from './MathUtils.js';
*/
class Vector2 {

/**
* Constructs a new 2D vector.
*
* @param {number} [x=0] - The x value of this vector.
* @param {number} [y=0] - The y value of this vector.
*/
constructor( x = 0, y = 0 ) {
static {

/**
* This flag can be used for type testing.
Expand All @@ -44,6 +38,16 @@ class Vector2 {
*/
Vector2.prototype.isVector2 = true;

}

/**
* Constructs a new 2D vector.
*
* @param {number} [x=0] - The x value of this vector.
* @param {number} [y=0] - The y value of this vector.
*/
constructor( x = 0, y = 0 ) {

/**
* The x value of this vector.
*
Expand Down
20 changes: 12 additions & 8 deletions src/math/Vector3.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,7 @@ import { Quaternion } from './Quaternion.js';
*/
class Vector3 {

/**
* Constructs a new 3D vector.
*
* @param {number} [x=0] - The x value of this vector.
* @param {number} [y=0] - The y value of this vector.
* @param {number} [z=0] - The z value of this vector.
*/
constructor( x = 0, y = 0, z = 0 ) {
static {

/**
* This flag can be used for type testing.
Expand All @@ -46,6 +39,17 @@ class Vector3 {
*/
Vector3.prototype.isVector3 = true;

}

/**
* Constructs a new 3D vector.
*
* @param {number} [x=0] - The x value of this vector.
* @param {number} [y=0] - The y value of this vector.
* @param {number} [z=0] - The z value of this vector.
*/
constructor( x = 0, y = 0, z = 0 ) {

/**
* The x value of this vector.
*
Expand Down
22 changes: 13 additions & 9 deletions src/math/Vector4.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,7 @@ import { clamp } from './MathUtils.js';
*/
class Vector4 {

/**
* Constructs a new 4D vector.
*
* @param {number} [x=0] - The x value of this vector.
* @param {number} [y=0] - The y value of this vector.
* @param {number} [z=0] - The z value of this vector.
* @param {number} [w=1] - The w value of this vector.
*/
constructor( x = 0, y = 0, z = 0, w = 1 ) {
static {

/**
* This flag can be used for type testing.
Expand All @@ -45,6 +37,18 @@ class Vector4 {
*/
Vector4.prototype.isVector4 = true;

}

/**
* Constructs a new 4D vector.
*
* @param {number} [x=0] - The x value of this vector.
* @param {number} [y=0] - The y value of this vector.
* @param {number} [z=0] - The z value of this vector.
* @param {number} [w=1] - The w value of this vector.
*/
constructor( x = 0, y = 0, z = 0, w = 1 ) {

/**
* The x value of this vector.
*
Expand Down