Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Update src/core/Vector3.js #2504

Closed
wants to merge 2 commits into from

3 participants

@Wilt

Hello THREE community!
Would be great if a function to get the angle to another vector could be implemented in this Vector3 class.
Hope you guys like the idea.

Wilt added some commits
@Wilt Wilt Update src/core/Vector3.js
Would be great if the function to get angle to anonther vector could be implemented in this Vector3 class.
Hope you guys like the idea.
385b472
@Wilt Wilt Update src/core/Vector3.js 739cd6e
@Wilt

Tapio, thanks for your very constructive comments.
I added the changes. Looks indeed much better now.

@tapio

One more nitpick (too late now, but for future): "Update that file" is not really a good summary of the changes - imagine having a lot of those in the git log - you have absolutely no idea what has been done if you don't dive into the diffs. Examples of more descriptive commit summaries for these commits would have been: "Add function to calculate angle between two Vector3s" and for the second one "Tweaked Vector3.angleTo() style and performance", or perhaps "Simplified Vector3.angleTo()" :)

@mrdoob
Owner

Looks good guys!
@tapio thanks for the guidance :)

@mrdoob
Owner

@Wilt One last thing. Try to target the dev branch next time.

@mrdoob
Owner

Merged in the dev branch. Thanks!

@mrdoob mrdoob closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Oct 12, 2012
  1. @Wilt

    Update src/core/Vector3.js

    Wilt authored
    Would be great if the function to get angle to anonther vector could be implemented in this Vector3 class.
    Hope you guys like the idea.
Commits on Oct 13, 2012
  1. @Wilt

    Update src/core/Vector3.js

    Wilt authored
This page is out of date. Refresh to see the latest.
Showing with 4 additions and 0 deletions.
  1. +4 −0 src/core/Vector3.js
View
4 src/core/Vector3.js
@@ -249,6 +249,10 @@ THREE.Vector3.prototype = {
},
+ angleTo: function ( v ) {
+ return Math.acos( this.dot( v ) / this.length() / v.length() );
+ };
+
distanceTo: function ( v ) {
return Math.sqrt( this.distanceToSquared( v ) );
Something went wrong with that request. Please try again.