Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: use same parameter names as in doc string #481

Merged
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
20 changes: 10 additions & 10 deletions packages/vectors/src/cartesian.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ export const cartesian: MultiVecOpVO<ReadonlyVec> = vop(1);
* @param v -
* @param offset -
*/
export const cartesian2 = cartesian.add(2, (out, a, b = ZERO2) =>
add2(out || a, cossin(a[1], a[0]), b)
export const cartesian2 = cartesian.add(2, (out, v, offset = ZERO2) =>
add2(out || v, cossin(v[1], v[0]), offset)
);

/**
Expand All @@ -40,15 +40,15 @@ export const cartesian2 = cartesian.add(2, (out, a, b = ZERO2) =>
* @param v -
* @param offset -
*/
export const cartesian3 = cartesian.add(3, (out, a, b = ZERO3) => {
const r = a[0];
const theta = a[1];
const phi = a[2];
export const cartesian3 = cartesian.add(3, (out, v, offset = ZERO3) => {
const r = v[0];
const theta = v[1];
const phi = v[2];
const ct = cos(theta);
return setC3(
out || a,
r * ct * cos(phi) + b[0],
r * ct * sin(phi) + b[1],
r * sin(theta) + b[2]
out || v,
r * ct * cos(phi) + offset[0],
r * ct * sin(phi) + offset[1],
r * sin(theta) + offset[2]
);
});
16 changes: 8 additions & 8 deletions packages/vectors/src/polar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ export const polar: MultiVecOpV = vop(1);
* @param out -
* @param v -
*/
export const polar2 = polar.add(2, (out, a) =>
setC2(out || a, mag(a), atan2(a[1], a[0]))
export const polar2 = polar.add(2, (out, v) =>
setC2(out || v, mag(v), atan2(v[1], v[0]))
);

/**
Expand All @@ -36,12 +36,12 @@ export const polar2 = polar.add(2, (out, a) =>
* @param out -
* @param v -
*/
export const polar3 = polar.add(3, (out, a) => {
const x = a[0];
const y = a[1];
const z = a[2];
export const polar3 = polar.add(3, (out, v) => {
const x = v[0];
const y = v[1];
const z = v[2];
const r = sqrt(x * x + y * y + z * z);
return r > 0
? setC3(out || a, r, asin(z / r), atan2(y, x))
: setC3(out || a, 0, 0, 0);
? setC3(out || v, r, asin(z / r), atan2(y, x))
: setC3(out || v, 0, 0, 0);
});