Installations
npm install gl-mat4
Releases
Unable to fetch releases
Developer
stackgl
Developer Guide
Module System
CommonJS
Min. Node Version
Typescript Support
No
Node Version
8.9.1
NPM Version
5.6.0
Statistics
79 Stars
44 Commits
14 Forks
17 Watching
1 Branches
20 Contributors
Updated on 17 Jan 2024
Languages
JavaScript (100%)
Total Downloads
Cumulative downloads
Total Downloads
39,702,171
Last day
-0.5%
37,890
Compared to previous day
Last week
0.8%
197,207
Compared to previous week
Last month
7.7%
842,028
Compared to previous month
Last year
14%
10,025,839
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Dev Dependencies
1
gl-mat4
Part of a fork of @toji's
gl-matrix split into smaller pieces: this
package contains glMatrix.mat4
.
Usage
mat4 = require('gl-mat4')
Will load all of the module's functionality and expose it on a single object. Note that any of the methods may also be required directly from their files.
For example, the following are equivalent:
1var scale = require('gl-mat4').scale 2var scale = require('gl-mat4/scale')
API
- add()
- adjoint()
- clone()
- copy()
- create()
- determinant()
- fromQuat()
- fromRotation()
- fromRotationTranslation()
- fromScaling()
- fromTranslation()
- fromXRotation()
- fromYRotation()
- fromZRotation()
- frustum()
- identity()
- invert()
- lookAt()
- multiply()
- ortho()
- perspective()
- perspectiveFromFieldOfView()
- rotate()
- rotateX()
- rotateY()
- rotateZ()
- scale()
- str()
- sub()
- translate()
- transpose()
add(out:mat4, a:mat4, b:mat4)
Adds two mat4's
adjoint(out:mat4, a:mat4)
Calculates the adjugate of a mat4
clone(a:mat4)
Creates a new mat4 initialized with values from an existing matrix
copy(out:mat4, a:mat4)
Copy the values from one mat4 to another
create()
Creates a new identity mat4
determinant(a:mat4)
Calculates the determinant of a mat4
fromQuat(out:mat4, q:quat4)
Creates a matrix from a quaternion rotation.
fromRotation(out:mat4, rad:number, axis:vec3)
Creates a matrix from a given angle around a given axis This is equivalent to (but much faster than):
1 mat4.identity(dest); 2 mat4.rotate(dest, dest, rad, axis);
fromRotationTranslation(out:mat4, q:quat4, v:vec3)
Creates a matrix from a quaternion rotation and vector translation. This is equivalent to (but much faster than):
1 mat4.identity(dest); 2 mat4.translate(dest, vec); 3 var quatMat = mat4.create(); 4 quat4.toMat4(quat, quatMat); 5 mat4.multiply(dest, quatMat);
fromScaling(out:mat4, v:vec3)
Creates a matrix from a vector scaling. This is equivalent to (but much faster than):
1 mat4.identity(dest); 2 mat4.translate(dest, dest, vec);
fromTranslation(out:mat4, v:vec3)
Creates a matrix from a vector translation. This is equivalent to (but much faster than):
1 mat4.identity(dest); 2 mat4.translate(dest, dest, vec);
fromTranslation(out:mat4, v:vec3)
Creates a matrix from a vector translation This is equivalent to (but much faster than):
1 mat4.identity(dest); 2 mat4.translate(dest, dest, vec);
fromXRotation(out:mat4, rad:Number)
Creates a matrix from the given angle around the X axis This is equivalent to (but much faster than):
1 mat4.identity(dest)
2 mat4.rotateX(dest, dest, rad)
fromYRotation(out:mat4, rad:Number)
Creates a matrix from the given angle around the Y axis This is equivalent to (but much faster than):
1 mat4.identity(dest)
2 mat4.rotateY(dest, dest, rad)
fromZRotation(out:mat4, rad:Number)
Creates a matrix from the given angle around the Z axis This is equivalent to (but much faster than):
1 mat4.identity(dest)
2 mat4.rotateZ(dest, dest, rad)
frustum(out:mat4, left:Number, right:Number, bottom:Number, top:Number, near:Number, far:Number)
Generates a frustum matrix with the given bounds
identity(out:mat4)
Set a mat4 to the identity matrix
invert(out:mat4, a:mat4)
Inverts a mat4
lookAt(out:mat4, eye:vec3, center:vec3, up:vec3)
Generates a look-at matrix with the given eye position, focal point, and up axis
multiply(out:mat4, a:mat4, b:mat4)
Multiplies two mat4's
ortho(out:mat4, left:number, right:number, bottom:number, top:number, near:number, far:number)
Generates a orthogonal projection matrix with the given bounds
perspective(out:mat4, fovy:number, aspect:number, near:number, far:number)
Generates a perspective projection matrix with the given bounds
perspectiveFromFieldOfView(out:mat4, fov:object, near:number, far:number)
Generates a perspective projection matrix with the given field of view.
rotate(out:mat4, a:mat4, rad:Number, axis:vec3)
Rotates a mat4 by the given angle
rotateX(out:mat4, a:mat4, rad:Number)
Rotates a matrix by the given angle around the X axis
rotateY(out:mat4, a:mat4, rad:Number)
Rotates a matrix by the given angle around the Y axis
rotateZ(out:mat4, a:mat4, rad:Number)
Rotates a matrix by the given angle around the Z axis
scale(out:mat4, a:mat4, v:vec3)
Scales the mat4 by the dimensions in the given vec3
str(mat:mat4)
Returns a string representation of a mat4
sub(out:mat4, a:mat4, b:mat4)
Subtracts two mat4's
translate(out:mat4, a:mat4, v:vec3)
Translate a mat4 by the given vector
transpose(out:mat4, a:mat4)
Transpose the values of a mat4
License
zlib. See LICENSE.md for details.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
- Info: project has a license file: LICENSE.md:0
- Info: FSF or OSI recognized license: zlib License: LICENSE.md:0
Reason
Found 4/19 approved changesets -- score normalized to 2
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 18 are checked with a SAST tool
Score
3.3
/10
Last Scanned on 2024-11-18
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More