Merge pull request #29047 from byGui/master

[gl-matrix] Add method vec2#rotate()
This commit is contained in:
Jesse Trinity
2018-09-20 16:03:54 -07:00
committed by GitHub
2 changed files with 17 additions and 5 deletions
+1
View File
@@ -74,6 +74,7 @@ outVec2 = vec2.cross(outVec3, vec2A, vec2B);
outVec2 = vec2.lerp(outVec2, vec2A, vec2B, 0.5);
outVec2 = vec2.random(outVec2);
outVec2 = vec2.random(outVec2, 5.0);
outVec2 = vec2.rotate(outVec2, vec2A, vec2B, Math.PI * 0.5);
outVec2 = vec2.transformMat2(outVec2, vec2A, mat2A);
outVec2 = vec2.transformMat2d(outVec2, vec2A, mat2dA);
outVec2 = vec2.transformMat3(outVec2, vec2A, mat3A);
+16 -5
View File
@@ -374,6 +374,17 @@ declare module 'gl-matrix' {
*/
public static random(out: vec2, scale: number): vec2;
/**
* Rotate a 2D vector
*
* @param out The receiving vec2
* @param a The vec2 point to rotate
* @param b The origin of the rotation
* @param c The angle of rotation
* @returns out
*/
public static rotate(out: vec2, a: vec2, b: vec2, c: number): vec2;
/**
* Transforms the vec2 with a mat2
*
@@ -1959,13 +1970,13 @@ declare module 'gl-matrix' {
* @returns out
*/
public static transpose(out: mat3, a: mat3): mat3;
/**
* Generates a 2D projection matrix with the given bounds
*
* @param out the receiving matrix
* @param width width of your gl context
* @param height height of gl context
* @param height height of gl context
* @returns out
*/
public static projection(out: mat3, width: number, height: number): mat3;
@@ -2510,9 +2521,9 @@ declare module 'gl-matrix' {
public static getTranslation(out: vec3, mat: mat4): vec3;
/**
* Returns the scaling factor component of a transformation matrix.
* If a matrix is built with fromRotationTranslationScale with a
* normalized Quaternion parameter, the returned vector will be
* Returns the scaling factor component of a transformation matrix.
* If a matrix is built with fromRotationTranslationScale with a
* normalized Quaternion parameter, the returned vector will be
* the same as the scaling vector originally supplied.
* @param {vec3} out Vector to receive scaling factor component
* @param {mat4} mat Matrix to be decomposed (input)