Skip to content

Commit

Permalink
Make use of Math.hypot()
Browse files Browse the repository at this point in the history
  • Loading branch information
ezzatron committed Apr 28, 2024
1 parent 031cd83 commit a4bc193
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/n_E2lat_lon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export function n_E2lat_lon(
const [x, y, z] = rotate(R_Ee, n_E);

const sinLat = x;
const cosLat = Math.sqrt(y ** 2 + z ** 2);
const cosLat = Math.hypot(y, z);
const sinLonCosLat = y;
const cosLonCosLat = -z;

Expand Down
2 changes: 1 addition & 1 deletion src/n_EB_E2p_EB_E.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export function n_EB_E2p_EB_E(
const sz = 1 - f;

// denominator = normalize(n_EB_e (vector) / scale (vector))
const denominator = Math.sqrt((x / sx) ** 2 + (y / sy) ** 2 + (z / sz) ** 2);
const denominator = Math.hypot(x / sx, y / sy, z / sz);

// p_EL_e = b (scalar) / denominator (scalar) * n_EB_e (vector) / scale (vector) ** 2
const p_EL_e_ratio = b / denominator;
Expand Down

0 comments on commit a4bc193

Please sign in to comment.