Browse Source

Merge branch 'dev' of https://github.com/mrdoob/three.js into dev

Mr.doob 10 years ago
parent
commit
2e53761eca
2 changed files with 11 additions and 0 deletions
  1. 6 0
      docs/api/math/Vector2.html
  2. 5 0
      src/math/Vector2.js

+ 6 - 0
docs/api/math/Vector2.html

@@ -103,6 +103,12 @@
 		Computes length of this vector.
 		</div>
 
+		<h3>[method:Float lengthManhattan]()</h3>
+		<div>
+		Computes Manhattan length of this vector.<br />
+		[link:http://en.wikipedia.org/wiki/Taxicab_geometry]
+		</div>
+
 		<h3>[method:Vector2 normalize]() [page:Vector2 this]</h3>
 		<div>
 		Normalizes this vector.

+ 5 - 0
src/math/Vector2.js

@@ -337,6 +337,11 @@ THREE.Vector2.prototype = {
 
 	},
 
+	lengthManhattan: function() {
+
+		return Math.abs( this.x ) + Math.abs( this.y );
+	},
+
 	normalize: function () {
 
 		return this.divideScalar( this.length() );