Mr.doob пре 13 година
родитељ
комит
8ea08a756c
5 измењених фајлова са 178 додато и 287 уклоњено
  1. 3 3
      docs/api/core/Vector2.html
  2. 156 5
      docs/api/core/Vector3.html
  3. 0 261
      docs/api/core/Vector3.rst
  4. 4 2
      docs/index.html
  5. 15 16
      src/core/Vector3.js

+ 3 - 3
docs/api/core/Vector2.html

@@ -1,13 +1,13 @@
 <h1>[name]</h1>
 
-<div class="desc">2D Vector</div>
+<div class="desc">2D Vector.</div>
 
 <h2>Example</h2>
 
 <code>var a = new THREE.Vector2( 0, 1 );
 var b = new THREE.Vector2( 1, 0 );
 
-var distance = a.distanceTo( b );
+var d = a.distanceTo( b );
 </code>
 
 
@@ -111,7 +111,7 @@ Normalizes this vector and multiplies it by *l*.
 Checks for strict equality of this vector and *v*.
 </div>
 
-<h3>.isZero() [page:Vector2]</h3>
+<h3>.isZero() [page:Boolean]</h3>
 <div>
 Checks if length of this vector is within small epsilon (*0.0001*).
 </div>

+ 156 - 5
docs/api/core/Vector3.html

@@ -1,23 +1,174 @@
 <h1>[name]</h1>
 
-<div class="desc">todo</div>
+<div class="desc">3D vector.</div>
+
+
+<h2>Example</h2>
+
+<code>var a = new THREE.Vector3( 1, 0, 0 );
+var b = new THREE.Vector3( 0, 1, 0 );
+
+var c = new THREE.Vector3();
+c.cross( a, b );
+</code>
 
 
 <h2>Constructor</h2>
 
-<h3>[name]()</h3>
+<h3>[name]( [page:Float x], [page:Float y], [page:Float z] )</h3>
 
 
 <h2>Properties</h2>
 
-<h3>.[page:Vector3 todo]</h3>
+<h3>.[page:Float x]</h3>
+
+<h3>.[page:Float y]</h3>
+
+<h3>.[page:Float z]</h3>
 
 
 <h2>Methods</h2>
 
-<h3>.todo( [page:Vector3 todo] )</h3>
+<h3>.set( [page:Float x], [page:Float y], [page:Float z] ) [page:Vector3]</h3>
+<div>
+Sets value of this vector.
+</div>
+
+<h3>.setX( [page:Float x] ) [page:Vector3]</h3>
+<div>
+Sets x value of this vector.
+</div>
+
+<h3>.setY( [page:Float y] ) [page:Vector3]</h3>
+<div>
+Sets y value of this vector.
+</div>
+
+<h3>.setZ( [page:Float z] ) [page:Vector3]</h3>
+<div>
+Sets z value of this vector.
+</div>
+
+<h3>.copy( [page:Vector3 v] ) [page:Vector3]</h3>
+<div>
+Copies value of *v* to this vector.
+</div>
+
+<h3>.add( [page:Vector3 a], [page:Vector3 b] ) [page:Vector3]</h3>
+<div>
+Sets this vector to *a + b*.
+</div>
+
+<h3>.addSelf( [page:Vector3 v] ) [page:Vector3]</h3>
+<div>
+Adds *v* to this vector.
+</div>
+
+<h3>.sub( [page:Vector3 a], [page:Vector3 b] ) [page:Vector3]</h3>
+<div>
+Sets this vector to *a - b*.
+</div>
+
+<h3>.subSelf( [page:Vector3 v] ) [page:Vector3]</h3>
+<div>
+Subtracts *v* from this vector.
+</div>
+
+<h3>.multiplyScalar( [page:Float s] ) [page:Vector3]</h3>
+<div>
+Multiplies this vector by scalar *s*.
+</div>
+
+<h3>.divideScalar( [page:Float s] ) [page:Vector3]</h3>
+<div>
+Divides this vector by scalar *s*.<br />
+Set vector to *( 0, 0, 0 )* if *s == 0*.
+</div>
+
+<h3>.negate() [page:Vector3]</h3>
+<div>
+Inverts this vector.
+</div>
+
+<h3>.dot( [page:Vector3 v] ) [page:Float]</h3>
+<div>
+Computes dot product of this vector and *v*.
+</div>
+
+<h3>.lengthSq() [page:Float]</h3>
+<div>
+Computes squared length of this vector.
+</div>
+
+<h3>.length() [page:Float]</h3>
+<div>
+Computes length of this vector.
+</div>
+
+<h3>.lengthManhattan() [page:Float]</h3>
+<div>
+Computes Manhattan length of this vector.<br />
+[link:http://en.wikipedia.org/wiki/Taxicab_geometry]
+</div>
+
+<h3>.normalize() [page:Vector3]</h3>
+<div>
+Normalizes this vector.
+</div>
+
+<h3>.distanceTo( [page:Vector3 v] ) [page:Vector3]</h3>
+<div>
+Computes distance of this vector to *v*.
+</div>
+
+<h3>.distanceToSquared( [page:Vector3 v] ) [page:Vector3]</h3>
+<div>
+Computes squared distance of this vector to *v*.
+</div>
+
+<h3>.setLength( [page:Float l] ) [page:Vector3]</h3>
+<div>
+Normalizes this vector and multiplies it by *l*.
+</div>
+
+<h3>.setLength( [page:Float l] ) [page:Vector3]</h3>
+<div>
+Normalizes this vector and multiplies it by *l*.
+</div>
+
+<h3>.cross( [page:Vector3 a], [page:Vector3 b] ) [page:Vector3]</h3>
+<div>
+Sets this vector to cross product of *a* and *b*.
+</div>
+
+<h3>.crossSelf( [page:Vector3 v] ) [page:Vector3]</h3>
+<div>
+Sets this vector to cross product of itself and *v*.
+</div>
+
+<h3>.setPositionFromMatrix( [page:Matrix4 m] ) [page:Vector3]</h3>
+<div>
+Sets this vector extracting position from matrix transform.
+</div>
+
+<h3>.setRotationFromMatrix( [page:Matrix4 m] ) [page:Vector3]</h3>
+<div>
+Sets this vector extracting Euler angles rotation from matrix transform.
+</div>
+
+<h3>.equals( [page:Vector3 v] ) [page:Vector3]</h3>
+<div>
+Checks for strict equality of this vector and *v*.
+</div>
+
+<h3>.isZero() [page:Boolean]</h3>
+<div>
+Checks if length of this vector is within small epsilon (*0.0001*).
+</div>
+
+<h3>.clone() [page:Vector3]</h3>
 <div>
-todo — todo<br />
+Clones this vector.
 </div>
 
 

+ 0 - 261
docs/api/core/Vector3.rst

@@ -1,261 +0,0 @@
-Vector3 - 3D vector
--------------------
-
-.. ...............................................................................
-.. rubric:: Constructor
-.. ...............................................................................
-
-.. class:: Vector3()
-
-    3D vector
-
-    :param float x: x-coordinate
-    :param float y: y-coordinate
-    :param float z: z-coordinate
-
-.. ...............................................................................
-.. rubric:: Attributes
-.. ...............................................................................
-
-.. attribute:: Vector3.x
-
-    float - default ``0``
-
-.. attribute:: Vector3.y
-
-    float - default ``0``
-
-.. attribute:: Vector3.z
-
-    float - default ``0``
-
-.. ...............................................................................
-.. rubric:: Methods
-.. ...............................................................................
-
-.. function:: Vector3.clone( )
-
-    Clones this vector
-
-    :returns: New instance identical to this vector
-    :rtype: :class:`Vector3`
-
-.. function:: Vector3.set( x, y, z )
-
-    Sets value of this vector
-
-    :param float x: x-coordinate
-    :param float y: y-coordinate
-    :param float z: z-coordinate
-    :returns: This vector
-    :rtype: :class:`Vector3`
-
-.. function:: Vector3.setX( x )
-
-    Sets x-value of this vector
-
-    :param float x: x-coordinate
-    :returns: This vector
-    :rtype: :class:`Vector3`
-
-.. function:: Vector3.setY( y )
-
-    Sets y-value of this vector
-
-    :param float y: y-coordinate
-    :returns: This vector
-    :rtype: :class:`Vector3`
-
-.. function:: Vector3.setZ( z )
-
-    Sets z-value of this vector
-
-    :param float z: z-coordinate
-    :returns: This vector
-    :rtype: :class:`Vector3`
-
-.. function:: Vector3.copy( v )
-
-    Copies value of ``v`` to this vector
-
-    :param Vector3 v: source vector
-    :returns: This vector
-    :rtype: :class:`Vector3`
-
-.. function:: Vector3.add( v1, v2 )
-
-    Sets this vector to ``v1 + v2``
-
-    :param Vector3 v1: source vector 1
-    :param Vector3 v2: source vector 2
-    :returns: This vector
-    :rtype: :class:`Vector3`
-
-.. function:: Vector3.addSelf( v )
-
-    Adds ``v`` to this vector
-
-    :param Vector3 v: source vector
-    :returns: This vector
-    :rtype: :class:`Vector3`
-
-.. function:: Vector3.sub( v1, v2 )
-
-    Sets this vector to ``v1 - v2``
-
-    :param Vector3 v1: source vector 1
-    :param Vector3 v2: source vector 2
-
-.. function:: Vector3.subSelf( v )
-
-    Subtracts ``v`` from this vector
-
-    :param Vector3 v: source vector
-    :returns: This vector
-    :rtype: :class:`Vector3`
-
-.. function:: Vector3.multiplyScalar( s )
-
-    Multiplies this vector by scalar ``s``
-
-    :param float s: scalar
-    :returns: This vector
-    :rtype: :class:`Vector3`
-
-.. function:: Vector3.divideScalar( s )
-
-    Divides this vector by scalar ``s``
-
-    Set vector to ``( 0, 0, 0 )`` if ``s == 0``
-
-    :param float s: scalar
-    :returns: This vector
-    :rtype: :class:`Vector3`
-
-.. function:: Vector3.negate( )
-
-    Inverts this vector
-
-    :returns: This vector
-    :rtype: :class:`Vector3`
-
-.. function:: Vector3.dot( v )
-
-    Computes dot product of this vector and ``v``
-
-    :param Vector3 v: vector
-    :returns: dot product
-    :rtype: float
-
-.. function:: Vector3.lengthSq( )
-
-    Computes squared length of this vector
-
-    :returns: squared length
-    :rtype: float
-
-.. function:: Vector3.length( )
-
-    Computes length of this vector
-
-    :returns: length
-    :rtype: float
-
-.. function:: Vector3.lengthManhattan( )
-
-    Computes Manhattan length of this vector
-
-    http://en.wikipedia.org/wiki/Taxicab_geometry
-
-    :returns: length
-    :rtype: float
-
-.. function:: Vector3.normalize( )
-
-    Normalizes this vector
-
-    :returns: This vector
-    :rtype: :class:`Vector3`
-
-.. function:: Vector3.distanceTo( v )
-
-    Computes distance of this vector to ``v``
-
-    :param Vector3 v: vector
-    :returns: squared distance
-    :rtype: float
-
-.. function:: Vector3.distanceToSquared( v )
-
-    Computes squared distance of this vector to ``v``
-
-    :param Vector3 v: vector
-    :returns: squared distance
-    :rtype: float
-
-.. function:: Vector3.setLength( l )
-
-    Normalizes this vector and multiplies it by ``l``
-
-    :returns: This vector
-    :rtype: :class:`Vector3`
-
-.. function:: Vector3.cross( a, b )
-
-    Sets this vector to cross product of ``a`` and ``b``
-
-    :param Vector3 a: vector
-    :param Vector3 b: vector
-    :returns: This vector
-    :rtype: :class:`Vector3`
-
-.. function:: Vector3.crossSelf( v )
-
-    Sets this vector to cross product of itself and ``v``
-
-    :param Vector3 v: vector
-    :returns: This vector
-    :rtype: :class:`Vector3`
-
-.. function:: Vector3.setPositionFromMatrix( m )
-
-    Sets this vector extracting position from matrix transform
-
-    :param Matrix4 m: matrix
-    :returns: This vector
-    :rtype: :class:`Vector3`
-
-.. function:: Vector3.setRotationFromMatrix( m )
-
-    Sets this vector extracting Euler angles rotation from matrix transform
-
-    :param Matrix4 m: matrix
-    :returns: This vector
-    :rtype: :class:`Vector3`
-
-.. function:: Vector3.equals( v )
-
-    Checks for strict equality of this vector and ``v``
-
-    :param Vector3 v: vector
-    :returns: true if this vector equals ``v``
-    :rtype: boolean
-
-.. function:: Vector3.isZero( )
-
-    Checks if length of this vector is within small epsilon (``0.0001``)
-
-    :returns: true if this vector is zero
-    :rtype: boolean
-
-.. ...............................................................................
-.. rubric:: Example
-.. ...............................................................................
-
-::
-
-    var a = new THREE.Vector3( 1, 0, 0 );
-    var b = new THREE.Vector3( 0, 1, 0 );
-
-    var c = new THREE.Vector3();
-    c.cross( a, b );

+ 4 - 2
docs/index.html

@@ -346,14 +346,16 @@
 
 					if ( xhr.readyState == 4 && ( xhr.status == 200 || xhr.status == 0 ) ) {
 
+						// TODO: Set title.
+
 						var text = xhr.responseText;
 						
 						text = text.replace(/\[name\]/gi, name);
 						text = text.replace(/\[path\]/gi, path);
 						text = text.replace(/\[page:(\w+)\]/gi, "[page:$1 $1]" ); // [page:name] to [page:name title]
 						text = text.replace(/\[page:(\w+) ([\w|\.]+)\]/gi, "<a href=\"javascript:goTo('$1')\" title=\"$1\">$2</a>" ); // [page:name title]
-						text = text.replace(/\[link:([\w|\:|\/|\.|\-]+)\]/gi, "[link:$1 $1" ); // [link:url] to [link:url title]
-						text = text.replace(/\[link:([\w|\:|\/|\.|\-]+) ([\w|\/|\.|\-]+)\]/gi, "<a href=\"$1\"  target=\"_blank\">$2</a>" ); // [link:url title]
+						text = text.replace(/\[link:([\w|\:|\/|\.|\-|\_]+)\]/gi, "[link:$1 $1]" ); // [link:url] to [link:url title]
+						text = text.replace(/\[link:([\w|\:|\/|\.|\-|\_]+) ([\w|\:|\/|\.|\-|\_]+)\]/gi, "<a href=\"$1\"  target=\"_blank\">$2</a>" ); // [link:url title]
 						text = text.replace(/\*([\w|\ |\-|\/|\+|\-|\(|\)|\=|\,|\.]+)\*/gi, "<strong>$1</strong>" ); // *
 
 						viewer.innerHTML = '<br>' + text + '<br><br>';

+ 15 - 16
src/core/Vector3.js

@@ -63,18 +63,11 @@ THREE.Vector3.prototype = {
 
 	},
 
-	clone: function () {
-
-		return new THREE.Vector3( this.x, this.y, this.z );
-
-	},
-
-
-	add: function ( v1, v2 ) {
+	add: function ( a, b ) {
 
-		this.x = v1.x + v2.x;
-		this.y = v1.y + v2.y;
-		this.z = v1.z + v2.z;
+		this.x = a.x + b.x;
+		this.y = a.y + b.y;
+		this.z = a.z + b.z;
 
 		return this;
 
@@ -100,11 +93,11 @@ THREE.Vector3.prototype = {
 
 	},
 
-	sub: function ( v1, v2 ) {
+	sub: function ( a, b ) {
 
-		this.x = v1.x - v2.x;
-		this.y = v1.y - v2.y;
-		this.z = v1.z - v2.z;
+		this.x = a.x - b.x;
+		this.y = a.y - b.y;
+		this.z = a.z - b.z;
 
 		return this;
 
@@ -183,7 +176,7 @@ THREE.Vector3.prototype = {
 
 	negate: function() {
 
-		return this.multiplyScalar( -1 );
+		return this.multiplyScalar( - 1 );
 
 	},
 
@@ -382,6 +375,12 @@ THREE.Vector3.prototype = {
 
 		return ( this.lengthSq() < 0.0001 /* almostZero */ );
 
+	},
+
+	clone: function () {
+
+		return new THREE.Vector3( this.x, this.y, this.z );
+
 	}
 
 };