diff --git a/docs/api/math/Vector2.html b/docs/api/math/Vector2.html index 625f88980809aa06b3955b15cf72f56bbf77ddbd..ed46ec0b77b6b66027df4ae4091a5f56f8a4590e 100644 --- a/docs/api/math/Vector2.html +++ b/docs/api/math/Vector2.html @@ -126,17 +126,17 @@

[method:Float lengthSq]() [page:Vector2 this]

- Computes squared length of this vector. + Computes the squared length of this vector.

[method:Float length]() [page:Vector2 this]

- Computes length of this vector. + Computes the length of this vector.

[method:Float lengthManhattan]() [page:Vector2 this]

- Computes Manhattan length of this vector.
+ Computes the Manhattan length of this vector.
[link:http://en.wikipedia.org/wiki/Taxicab_geometry]
@@ -152,12 +152,17 @@

[method:Float distanceTo]( [page:Vector2 v] )

- Computes distance of this vector to *v*. + Computes the distance from this vector to *v*.

[method:Float distanceToSquared]( [page:Vector2 v] )

- Computes squared distance of this vector to *v*. + Computes the squared distance from this vector to *v*. +
+ +

[method:Float distanceToManhattan]( [page:Vector2 v] )

+
+ Computes the Manhattan distance from this vector to *v*.

[method:Vector2 setLength]( [page:Float l] ) [page:Vector2 this]

diff --git a/docs/api/math/Vector3.html b/docs/api/math/Vector3.html index 9f5b3812592da74937f4cfa1977fd275a264afc6..ed0b62b55dbb92bd129c6651e338ce0d95ff178a 100644 --- a/docs/api/math/Vector3.html +++ b/docs/api/math/Vector3.html @@ -130,17 +130,17 @@

[method:Float lengthSq]() [page:Vector3 this]

- Computes squared length of this vector. + Computes the squared length of this vector.

[method:Float length]() [page:Vector3 this]

- Computes length of this vector. + Computes the length of this vector.

[method:Float lengthManhattan]() [page:Vector3 this]

- Computes Manhattan length of this vector.
+ Computes the Manhattan length of this vector.
[link:http://en.wikipedia.org/wiki/Taxicab_geometry]
@@ -149,14 +149,19 @@ Normalizes this vector. Transforms this Vector into a Unit vector by dividing the vector by its length. -

[method:Float distanceTo]( [page:Vector3 v] ) [page:Vector3 this]

+

[method:Float distanceTo]( [page:Vector3 v] )

- Computes distance of this vector to *v*. + Computes the distance from this vector to *v*.
-

[method:Float distanceToSquared]( [page:Vector3 v] ) [page:Vector3 this]

+

[method:Float distanceToSquared]( [page:Vector3 v] )

- Computes squared distance of this vector to *v*. + Computes the squared distance from this vector to *v*. +
+ +

[method:Float distanceToManhattan]( [page:Vector3 v] )

+
+ Computes the Manhattan distance from this vector to *v*.

[method:Vector3 setLength]( [page:Float l] ) [page:Vector3 this]

diff --git a/docs/api/math/Vector4.html b/docs/api/math/Vector4.html index a7f33f87aaed69161a291608d79ad84702aa3a8f..1aa7264616d50024a7eda44ef8d12a035f7ae780 100644 --- a/docs/api/math/Vector4.html +++ b/docs/api/math/Vector4.html @@ -137,12 +137,18 @@

[method:Float lengthSq]() [page:Vector4 this]

- Computes squared length of this vector. + Computes the squared length of this vector.

[method:Float length]() [page:Vector4 this]

- Computes length of this vector. + Computes the length of this vector. +
+ +

[method:Float lengthManhattan]() [page:Vector4 this]

+
+ Computes the Manhattan length of this vector.
+ [link:http://en.wikipedia.org/wiki/Taxicab_geometry]

[method:Vector4 normalize]() [page:Vector4 this]

@@ -294,12 +300,6 @@ Index 3: w
-

[method:Float lengthManhattan]() [page:Vector4 this]

-
- Computes Manhattan length of this vector.
- [link:http://en.wikipedia.org/wiki/Taxicab_geometry] -
-

[method:Vector4 clone]() [page:Vector4 this]

Clones this vector. diff --git a/src/math/Vector2.js b/src/math/Vector2.js index a016a737336e6a7cdaa7ec0a84055ffa0dfab511..fb5b27c2bc3473d8041029fbb83d3dcdfceb3342 100644 --- a/src/math/Vector2.js +++ b/src/math/Vector2.js @@ -393,6 +393,12 @@ THREE.Vector2.prototype = { }, + distanceToManhattan: function ( v ) { + + return Math.abs( this.x - v.x ) + Math.abs( this.y - v.y ); + + }, + setLength: function ( length ) { return this.multiplyScalar( length / this.length() ); diff --git a/src/math/Vector3.js b/src/math/Vector3.js index 0fc8ca4d3caec27c50c5fb914e95f9909123229a..25acd8421f4412fdabb0f1f478402f94fcc84c72 100644 --- a/src/math/Vector3.js +++ b/src/math/Vector3.js @@ -659,6 +659,12 @@ THREE.Vector3.prototype = { }, + distanceToManhattan: function ( v ) { + + return Math.abs( this.x - v.x ) + Math.abs( this.y - v.y ) + Math.abs( this.z - v.z ); + + }, + setFromSpherical: function( s ) { var sinPhiRadius = Math.sin( s.phi ) * s.radius;