Skip to content

Commit

Permalink
Merge pull request #430 from munsocket/master
Browse files Browse the repository at this point in the history
Optimize angle(v1, v2)
  • Loading branch information
stefnotch authored Jun 2, 2021
2 parents fccd5f7 + 07e80bf commit be9e9b5
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/vec3.js
Original file line number Diff line number Diff line change
Expand Up @@ -675,9 +675,7 @@ export function angle(a, b) {
bx = b[0],
by = b[1],
bz = b[2],
mag1 = Math.sqrt(ax * ax + ay * ay + az * az),
mag2 = Math.sqrt(bx * bx + by * by + bz * bz),
mag = mag1 * mag2,
mag = Math.sqrt((ax * ax + ay * ay + az * az) * (bx * bx + by * by + bz * bz)),
cosine = mag && dot(a, b) / mag;
return Math.acos(Math.min(Math.max(cosine, -1), 1));
}
Expand Down

0 comments on commit be9e9b5

Please sign in to comment.