Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
appease the lint gods
Browse files Browse the repository at this point in the history
mreinstein committed Mar 20, 2024
1 parent 4a99254 commit 56ecb8a
Showing 2 changed files with 17 additions and 14 deletions.
10 changes: 5 additions & 5 deletions src/vec2-impl.ts
Original file line number Diff line number Diff line change
@@ -646,7 +646,7 @@ export function transformMat3(v: Vec2, m: Mat3, dst?: Vec2): Vec2 {

/**
* Rotate a 2D vector
*
*
* @param a The vec2 point to rotate
* @param b The origin of the rotation
* @param rad The angle of rotation in radians
@@ -656,10 +656,10 @@ export function rotate(a: Vec2, b: Vec2, rad: number, dst?: Vec2) {
dst = dst || new VecType(2);

// Translate point to the origin
const p0 = a[0] - b[0],
p1 = a[1] - b[1],
sinC = Math.sin(rad),
cosC = Math.cos(rad);
const p0 = a[0] - b[0];
const p1 = a[1] - b[1];
const sinC = Math.sin(rad);
const cosC = Math.cos(rad);

//perform rotation and translate to correct position
dst[0] = p0 * cosC - p1 * sinC + b[0];
21 changes: 12 additions & 9 deletions src/vec3-impl.ts
Original file line number Diff line number Diff line change
@@ -790,7 +790,7 @@ export function getScaling(m: Mat4, dst: Vec3) {

/**
* Rotate a 3D vector around the x-axis
*
*
* @param {ReadonlyVec3} a The vec3 point to rotate
* @param {ReadonlyVec3} b The origin of the rotation
* @param {Number} rad The angle of rotation in radians
@@ -799,8 +799,9 @@ export function getScaling(m: Mat4, dst: Vec3) {
*/
export function rotateX(a: Vec3, b: Vec3, rad: number, dst?: Vec3) {
dst = dst || new VecType(3);
let p = [],
r = [];
const p = [];
const r = [];

//Translate point to the origin
p[0] = a[0] - b[0];
p[1] = a[1] - b[1];
@@ -821,7 +822,7 @@ export function rotateX(a: Vec3, b: Vec3, rad: number, dst?: Vec3) {

/**
* Rotate a 3D vector around the y-axis
*
*
* @param {ReadonlyVec3} a The vec3 point to rotate
* @param {ReadonlyVec3} b The origin of the rotation
* @param {Number} rad The angle of rotation in radians
@@ -830,8 +831,9 @@ export function rotateX(a: Vec3, b: Vec3, rad: number, dst?: Vec3) {
*/
export function rotateY(a: Vec3, b: Vec3, rad: number, dst?: Vec3) {
dst = dst || new VecType(3);
let p = [],
r = [];
const p = [];
const r = [];

// translate point to the origin
p[0] = a[0] - b[0];
p[1] = a[1] - b[1];
@@ -852,7 +854,7 @@ export function rotateY(a: Vec3, b: Vec3, rad: number, dst?: Vec3) {

/**
* Rotate a 3D vector around the z-axis
*
*
* @param {ReadonlyVec3} a The vec3 point to rotate
* @param {ReadonlyVec3} b The origin of the rotation
* @param {Number} rad The angle of rotation in radians
@@ -861,8 +863,9 @@ export function rotateY(a: Vec3, b: Vec3, rad: number, dst?: Vec3) {
*/
export function rotateZ(a: Vec3, b: Vec3, rad: number, dst?: Vec3) {
dst = dst || new VecType(3);
let p = [],
r = [];
const p = [];
const r = [];

// translate point to the origin
p[0] = a[0] - b[0];
p[1] = a[1] - b[1];

0 comments on commit 56ecb8a

Please sign in to comment.