提交 7b46e067 编写于 作者: S Sebastien Valette

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

.DS_Store
*.swp
.project
docs/_build
.project
\ No newline at end of file
The MIT License
Copyright (c) 2010-2012 three.js Authors. All rights reserved.
Copyright (c) 2010-2012 Three.js authors.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
......
......@@ -142,7 +142,7 @@ This code creates a camera, then creates a scene, adds a cube on it, creates a &
</script>
```
### Change Log ###
### Change log ###
2012 03 04 - **r48** (393,626 KB, gzip: 99,395 KB)
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
......@@ -29,4 +29,4 @@ vector — point to look at<br />
<h2>Source</h2>
<a href="https://github.com/mrdoob/three.js/blob/master/src/[path].js" target="_blank">src/[path].js</a>
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
\ No newline at end of file
......@@ -7,7 +7,7 @@
<h2>Example</h2>
<code>var camera = new THREE.OrthographicCamera( window.innerWidth / - 2, window.innerWidth / 2, window.innerHeight / 2, window.innerHeight / - 2, 1, 1000 );
<code>var camera = new THREE.OrthographicCamera( width / - 2, width / 2, height / 2, height / - 2, 1, 1000 );
scene.add( camera );
</code>
......@@ -56,4 +56,4 @@ Updates the camera projection matrix. Must be called after change of parameters.
<h2>Source</h2>
<a href="https://github.com/mrdoob/three.js/blob/master/src/[path].js" target="_blank">src/[path].js</a>
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
\ No newline at end of file
......@@ -7,7 +7,7 @@
<h2>Example</h2>
<code>var camera = new THREE.PerspectiveCamera( 45, window.innerWidth / window.innerHeight, 1, 1000 );
<code>var camera = new THREE.PerspectiveCamera( 45, width / height, 1, 1000 );
scene.add( camera );
</code>
......@@ -48,7 +48,7 @@ frameSize — frame size
<div>
Uses focal length (in mm) to estimate and set FOV 35mm (fullframe) camera is used if frame size is not specified.<br />
Formula based on <a href="http://www.bobatkins.com/photography/technical/field_of_view.html" target="_blank">http://www.bobatkins.com/photography/technical/field_of_view.html</a>
Formula based on [link:http://www.bobatkins.com/photography/technical/field_of_view.html]
</div>
<h3>.setViewOffset( [page:Float fullWidth], [page:Float fullHeight], [page:Float x], [page:Float y], [page:Float width], [page:Float height] )</h3>
......@@ -107,4 +107,4 @@ Updates the camera projection matrix. Must be called after change of parameters.
<h2>Source</h2>
<a href="https://github.com/mrdoob/three.js/blob/master/src/[path].js" target="_blank">src/[path].js</a>
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
\ No newline at end of file
......@@ -48,4 +48,4 @@ Get the milliseconds passed since the last call to this method.
<h2>Source</h2>
<a href="https://github.com/mrdoob/three.js/blob/master/src/[path].js" target="_blank">src/[path].js</a>
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
\ No newline at end of file
......@@ -112,9 +112,9 @@ Example: rgb(r, g, b)
<h3>.clone() [page:Color]</h3>
<div>
Clones this object.
Clones this color.
</div>
<h2>Source</h2>
<a href="https://github.com/mrdoob/three.js/blob/master/src/[path].js" target="_blank">src/[path].js</a>
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
\ No newline at end of file
......@@ -78,4 +78,4 @@ Face centroid.
<h2>Source</h2>
<a href="https://github.com/mrdoob/three.js/blob/master/src/[path].js" target="_blank">src/[path].js</a>
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
\ No newline at end of file
......@@ -84,4 +84,4 @@ Face centroid.
<h2>Source</h2>
<a href="https://github.com/mrdoob/three.js/blob/master/src/[path].js" target="_blank">src/[path].js</a>
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
\ No newline at end of file
......@@ -27,4 +27,4 @@ Checks whether the object is inside the Frustum.
<h2>Source</h2>
<a href="https://github.com/mrdoob/three.js/blob/master/src/[path].js" target="_blank">src/[path].js</a>
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
\ No newline at end of file
......@@ -11,11 +11,10 @@ var geometry = new THREE.Geometry()
for ( var i = 0; i < 10000; i ++ ) {
var vertex = new THREE.Vertex();
vertex.position.x = Math.random() * 1000 - 500;
vertex.position.y = Math.random() * 1000 - 500;
vertex.position.z = Math.random() * 1000 - 500;
var vertex = new THREE.Vector3();
vertex.x = Math.random() * 1000 - 500;
vertex.y = Math.random() * 1000 - 500;
vertex.z = Math.random() * 1000 - 500;
geometry.vertices.push( vertex );
}
......@@ -37,7 +36,7 @@ Unique number of this geometry instance
<h3>.[page:Array vertices]</h3>
<div>
Array of [page:Vertex vertices].
Array of [page:Vector3 vertices].
</div>
<h3>.[page:Array colors]</h3>
......@@ -112,7 +111,7 @@ True if geometry has tangents. Set in [page:Geometry Geometry.computeTangents].
<h3>.[page:Boolean dynamic]</h3>
<div>
Set to <strong>true</strong> if attribute buffers will need to change in runtime (using "dirty" flags).<br/>
Set to *true* if attribute buffers will need to change in runtime (using "dirty" flags).<br/>
Unless set to true internal typed arrays corresponding to buffers will be deleted once sent to GPU.
</div>
......@@ -143,7 +142,7 @@ Face normals must be existing / computed beforehand.
<h3>.computeTangents()</h3>
<div>
Computes vertex tangents.<br />
Based on <a href="http://www.terathon.com/code/tangent.html" target="_blank">http://www.terathon.com/code/tangent.html</a><br />
Based on [link:http://www.terathon.com/code/tangent.html]<br />
Geometry must have vertex [page:UV UVs] (layer 0 will be used).
</div>
......@@ -166,4 +165,4 @@ Duplicated vertices are removed and faces' vertices are updated.
<h2>Source</h2>
<a href="https://github.com/mrdoob/three.js/blob/master/src/[path].js" target="_blank">src/[path].js</a>
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
......@@ -12,7 +12,7 @@ a — Minimum value<br />
b — Maximum value.
</div>
<div>
Clamps the <strong>x</strong> to be between <strong>a</strong> and <strong>b</strong>.
Clamps the *x* to be between *a* and *b*.
</div>
<h3>.clampBottom( [page:Float x], [page:Float a] ) [page:Float]</h3>
......@@ -21,7 +21,7 @@ x — Value to be clamped.<br />
a — Minimum value
</div>
<div>
Clamps the <strong>x</strong> to be larger than <strong>a</strong>.
Clamps the *x* to be larger than *a*.
</div>
<h3>.mapLinear( [page:Float x], [page:Float a] ) [page:Float]</h3>
......@@ -33,7 +33,7 @@ b1 — Minimum value for range B.<br />
b2 — Maximum value for range B.
</div>
<div>
Linear mapping of <strong>x</strong> from range [<strong>a1</strong>, <strong>a2</strong>] to range [<strong>b1</strong>, <strong>b2</strong>].
Linear mapping of *x* from range [*a1*, *a2*] to range [*b1*, *b2*].
</div>
<h3>.random16() [page:Float]</h3>
......@@ -44,20 +44,20 @@ Standard Math.random() creates repetitive patterns when applied over larger spac
<h3>.randInt( [page:Integer low], [page:Integer high] ) [page:Integer]</h3>
<div>
Random integer from <strong>low</strong> to <strong>high</strong> interval.
Random integer from *low* to *high* interval.
</div>
<h3>.randFloat( [page:Float low], [page:Float high] ) [page:Float]</h3>
<div>
Random float from <strong>low</strong> to <strong>high</strong> interval.
Random float from *low* to *high* interval.
</div>
<h3>.randFloatSpread( [page:Float range] ) [page:Float]</h3>
<div>
Random float from <strong>- range / 2</strong> to <strong>range / 2</strong> interval.
Random float from *- range / 2* to *range / 2* interval.
</div>
<h2>Source</h2>
<a href="https://github.com/mrdoob/three.js/blob/master/src/[path].js" target="_blank">src/[path].js</a>
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
\ No newline at end of file
......@@ -31,4 +31,4 @@ Transposes this matrix into supplied array.
<h2>Source</h2>
<a href="https://github.com/mrdoob/three.js/blob/master/src/[path].js" target="_blank">src/[path].js</a>
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
\ No newline at end of file
......@@ -33,78 +33,270 @@ m.multiplySelf( m3 );
<h2>Properties</h2>
<h3>.[page:Float n11]</h3>
<h3>.[page:Float32Array elements]</h3>
<h3>.[page:Float n12]</h3>
<h3>.[page:Float n13]</h3>
<h2>Methods</h2>
<h3>.[page:Float n14]</h3>
<h3>.set( [page:Float n11], [page:Float n12], [page:Float n13], [page:Float n14], [page:Float n21], [page:Float n22], [page:Float n23], [page:Float n24], [page:Float n31], [page:Float n32], [page:Float n33], [page:Float n34], [page:Float n41], [page:Float n42], [page:Float n43], [page:Float n44] ) [page:Matrix4]</h3>
<div>
Sets all fields of this matrix.
</div>
<h3>.[page:Float n21]</h3>
<h3>.identity() [page:Matrix4]</h3>
<div>
Resets this matrix to identity.
</div>
<h3>.[page:Float n22]</h3>
<h3>.copy( [page:Matrix4 m] ) [page:Matrix4]</h3>
<div>
Copies a matrix *m* into this matrix.
</div>
<h3>.[page:Float n23]</h3>
<h3>.lookAt( [page:Vector3 eye], [page:Vector3 center], [page:Vector3 up], ) [page:Matrix4]</h3>
<div>
Constructs a rotation matrix, looking from *eye* towards *center* with defined *up* vector.
</div>
<h3>.[page:Float n24]</h3>
<h3>.multiply( [page:Matrix4 a], [page:Matrix4 b] ) [page:Matrix4]</h3>
<div>
Sets this matrix to *a x b*.
</div>
<h3>.[page:Float n31]</h3>
<h3>.multiplySelf( [page:Matrix4 m] ) [page:Matrix4]</h3>
<div>
Multiplies this matrix by *m*.
</div>
<h3>.[page:Float n32]</h3>
<h3>.multiplyToArray( [page:Matrix4 a], [page:Matrix4 b], [page:Array r] ) [page:Matrix4]</h3>
<div>
Sets this matrix to *a x b* and sets result into flat array *r*.<br />
Destination array can be regular Array or TypedArray.
</div>
<h3>.[page:Float n33]</h3>
<h3>.multiplyScalar( [page:Float s] ) [page:Matrix4]</h3>
<div>
Multiplies this matrix by *s*.
</div>
<h3>.[page:Float n34]</h3>
<h3>.multiplyVector3( [page:Vector3 v] ) [page:Vector3]</h3>
<div>
Applies this matrix to *v*.
</div>
<h3>.[page:Float n41]</h3>
<h3>.multiplyVector4( [page:Vector4 v] ) [page:Vector4]</h3>
<div>
Applies this matrix to *v*.
</div>
<h3>.[page:Float n42]</h3>
<h3>.rotateAxis( [page:Vector3 v] ) [page:Vector3]</h3>
<div>
Applies rotation submatrix of this matrix to vector *v* and then normalizes it.
</div>
<h3>.[page:Float n43]</h3>
<h3>.crossVector( [page:Vector4 a] ) [page:Vector4]</h3>
<h3>.[page:Float n44]</h3>
<h3>.determinant() [page:Float]</h3>
<div>
Computes determinant of this matrix.<br />
Based on [link:http://www.euclideanspace.com/maths/algebra/matrix/functions/inverse/fourD/index.htm]
</div>
<h3>.transpose() [page:Matrix4]</h3>
<div>
Transposes this matrix.
</div>
<h2>Methods</h2>
<h3>.flatten() [page:Array]</h3>
<div>
Flattens this matrix into internal [page:Matrix4 Matrix4.flat] array.
</div>
<h3>.set( [page:Float n11], [page:Float n12], [page:Float n13], [page:Float n14], [page:Float n21], [page:Float n22], [page:Float n23], [page:Float n24], [page:Float n31], [page:Float n32], [page:Float n33], [page:Float n34], [page:Float n41], [page:Float n42], [page:Float n43], [page:Float n44] ) [page:Matrix4]</h3>
<h3>.flattenToArray( [page:Array flat] ) [page:Array]</h3>
<div>
Sets all fields of this matrix.
Flattens this matrix into supplied *flat* array.
</div>
<h3>.identity() [page:Matrix4]</h3>
<h3>.flattenToArrayOffset( [page:Array flat], [page:Integer offset] ) [page:Array]</h3>
<div>
Resets this matrix to identity.
Flattens this matrix into supplied *flat* array starting from *offset* position in the array.
</div>
<h3>.copy( [page:Matrix4 m] ) [page:Matrix4]</h3>
<h3>.setTranslation( [page:Float x], [page:Float y], [page:Float z] ) [page:Matrix4]</h3>
<div>
Copies a matrix <strong>m</strong> into this matrix.
Sets this matrix as translation transform.
</div>
<h3>.lookAt( [page:Vector3 eye], [page:Vector3 center], [page:Vector3 up], ) [page:Matrix4]</h3>
<h3>.setScale( [page:Float x], [page:Float y], [page:Float z] ) [page:Matrix4]</h3>
<div>
Constructs a rotation matrix, looking from <strong>eye</strong> towards <strong>center</strong> with defined <strong>up</strong> vector.
Sets this matrix as scale transform.
</div>
<h3>.multiply( [page:Matrix4 a], [page:Matrix4 b] ) [page:Matrix4]</h3>
<h3>.setRotationX( [page:Float theta] ) [page:Matrix4]</h3>
<div>
Sets this matrix to <strong>a * b</strong>.
theta — Rotation angle in radians.
</div>
<div>
Sets this matrix as rotation transform around x axis by *theta* radians.
</div>
<h3>.multiplySelf( [page:Matrix4 m] ) [page:Matrix4]</h3>
<h3>.setRotationY( [page:Float theta] ) [page:Matrix4]</h3>
<div>
Multiplies this matrix by <strong>m</strong>.
theta — Rotation angle in radians.
</div>
<div>
Sets this matrix as rotation transform around y axis by *theta* radians.
</div>
<h3>.multiplyToArray( [page:Matrix4 a], [page:Matrix4 b], [page:Array r] ) [page:Matrix4]</h3>
<h3>.setRotationZ( [page:Float theta] ) [page:Matrix4]</h3>
<div>
Sets this matrix to <strong>a * b</strong> and sets result into flat array <strong>r</strong>.<br />
Destination array can be regular Array or TypedArray.
theta — Rotation angle in radians.
</div>
<div>
Sets this matrix as rotation transform around z axis by *theta* radians.
</div>
<h3>.setRotationAxis( [page:Vector3 axis], [page:Float theta] ) [page:Matrix4]</h3>
<div>
axis — Rotation axis.
theta — Rotation angle in radians.
</div>
<div>
Sets this matrix as rotation transform around *axis* by *angle* radians.<br />
Based on [link:http://www.gamedev.net/reference/articles/article1199.asp].
</div>
<h3>.setPosition( [page:Vector3 v] ) [page:Matrix4]</h3>
<div>
Sets the position component for this matrix from vector *v*.
</div>
<h3>.getPosition() [page:Vector3]</h3>
<div>
Returns position component from this matrix.<br />
Note: this method returns a reference to internal class vector, make copy or clone if you don't use it right away.
</div>
<h3>.getColumnX() [page:Vector3]</h3>
<div>
Returns x column component from this matrix.<br />
Note: this method returns a reference to internal class vector, make copy or clone if you don't use it right away.
</div>
<h3>.getColumnY() [page:Vector3]</h3>
<div>
Returns y column component from this matrix.<br />
Note: this method returns a reference to internal class vector, make copy or clone if you don't use it right away.
</div>
<h3>.getColumnZ() [page:Vector3]</h3>
<div>
Returns z column component from this matrix.<br />
Note: this method returns a reference to internal class vector, make copy or clone if you don't use it right away.
</div>
<h3>.getInverse( [page:Matrix4 m] ) [page:Matrix4]</h3>
<div>
Sets this matrix to inverse of matrix *m*.<br />
Based on [link:http://www.euclideanspace.com/maths/algebra/matrix/functions/inverse/fourD/index.htm].
</div>
<h3>.setRotationFromEuler( [page:Vector3 v], [page:String order] ) [page:Matrix4]</h3>
<div>
v — Rotation vector.
order — The order of rotations. Eg. "XYZ".
</div>
<div>
Sets rotation submatrix of this matrix to rotation specified by Euler angles.<br />
Default order "XYZ".
</div>
<h3>.setRotationFromQuaternion( [page:Quaternion q] ) [page:Matrix4]</h3>
<div>
Sets rotation submatrix of this matrix to rotation specified by *q*.
</div>
<h3>.scale( [page:Vector3 v] ) [page:Matrix4]</h3>
<div>
Multiplies columns of this matrix by vector *v*.
</div>
<h3>.compose( [page:Vector3 translation], [page:Quaternion rotation], [page:Vector3 scale] ) [page:Matrix4]</h3>
<div>
Sets this matrix to transform composed of *translation*, *rotation* and *scale*.
</div>
<h3>.decompose( [page:Vector3 translation], [page:Quaternion rotation], [page:Vector3 scale] ) [page:Array]</h3>
<div>
Decomposes this matrix into *translation*, *rotation* and *scale* components.<br />
If parameters are not supplied, new instances will be created.
</div>
<h3>.extractPosition( [page:Matrix4 m] ) [page:Matrix4]</h3>
<div>
Copies translation component of supplied matrix *m* into this matrix translation.
</div>
<h3>.extractRotation( [page:Matrix4 m] ) [page:Matrix4]</h3>
<div>
Copies rotation component of supplied matrix *m* into this matrix rotation.
</div>
<h3>.rotateByAxis( [page:Vector3 axis], [page:Float angle] ) [page:Matrix4]</h3>
<div>
Rotates this matrix around supplied *axis* by *angle*.
</div>
<h3>.rotateX( [page:Float angle] ) [page:Matrix4]</h3>
<div>
Rotates this matrix around x axis by *angle*.
</div>
<h3>.rotateY( [page:Float angle] ) [page:Matrix4]</h3>
<div>
Rotates this matrix around y axis by *angle*.
</div>
<h3>.rotateZ( [page:Float angle] ) [page:Matrix4]</h3>
<div>
Rotates this matrix around z axis by *angle*.
</div>
<h3>.translate( [page:Vector3 v] ) [page:Matrix4]</h3>
<div>
Translates this matrix by vector *v*.
</div>
<h3>.clone() [page:Matrix4]</h3>
<div>
Clones this matrix.
</div>
<h2>Static methods</h2>
<h3>.makeInvert3x3( [page:Matrix4 m] ) [page:Matrix3]</h3>
<div>
Inverts just rotation submatrix of matrix *m*.<br />
Note: this method returns a reference to internal 3x3 matrix, make copy or clone if you don't use it right away.<br />
Based on [link:http://code.google.com/p/webgl-mjs/].
</div>
<h3>.makeFrustum( [page:Float left], [page:Float right], [page:Float bottom], [page:Float top], [page:Float near], [page:Float far] ) [page:Matrix4]</h3>
<div>
Creates frustum matrix.
</div>
<h3>.makePerspective( [page:Float fov], [page:Float aspect], [page:Float near], [page:Float far] ) [page:Matrix4]</h3>
<div>
Creates perspective projection matrix.
</div>
<h3>.makeOrtho( [page:Float left], [page:Float right], [page:Float bottom], [page:Float top], [page:Float near], [page:Float far] ) [page:Matrix4]</h3>
<div>
Creates orthographic projection matrix.
</div>
<h2>Source</h2>
<a href="https://github.com/mrdoob/three.js/blob/master/src/[path].js" target="_blank">src/[path].js</a>
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
Matrix4 - A 4x4 Matrix
----------------------
.. ...............................................................................
.. rubric:: Constructor
.. ...............................................................................
.. class:: Matrix4( n11, n12, n13, n14, n21, n22, n23, n24, n31, n32, n33, n34, n41, n42, n43, n44 )
A 4x4 Matrix
.. ...............................................................................
.. rubric:: Attributes
.. ...............................................................................
.. attribute:: Matrix4.n11
.. attribute:: Matrix4.n12
.. attribute:: Matrix4.n13
.. attribute:: Matrix4.n14
.. attribute:: Matrix4.n21
.. attribute:: Matrix4.n22
.. attribute:: Matrix4.n23
.. attribute:: Matrix4.n24
.. attribute:: Matrix4.n31
.. attribute:: Matrix4.n32
.. attribute:: Matrix4.n33
.. attribute:: Matrix4.n34
.. attribute:: Matrix4.n41
.. attribute:: Matrix4.n42
.. attribute:: Matrix4.n43
.. attribute:: Matrix4.n44
.. ...............................................................................
.. rubric:: Methods
.. ...............................................................................
.. function:: Matrix4.clone( )
Clones this matrix
:returns: New instance identical to this matrix
:rtype: :class:`Matrix4`
.. function:: Matrix4.set( n11, n12, n13, n14, n21, n22, n23, n24, n31, n32, n33, n34, n41, n42, n43, n44 )
Sets all fields of this matrix
:returns: This matrix
:rtype: :class:`Matrix4`
.. function:: Matrix4.identity()
Resets this matrix to identity
:returns: This matrix
:rtype: :class:`Matrix4`
.. function:: Matrix4.copy( m )
Copies a matrix ``m`` into this matrix
:param Matrix4 m: Matrix to be copied
:returns: This matrix
:rtype: :class:`Matrix4`
.. function:: Matrix4.lookAt( eye, center, up )
Constructs rotation matrix, looking from ``eye`` towards ``center`` with defined ``up`` vector
:param Vector3 eye: vector
:param Vector3 center: vector
:param Vector3 up: vector
:returns: This matrix
:rtype: :class:`Matrix4`
.. function:: Matrix4.multiply( a, b )
Sets this matrix to ``a * b``
:param Matrix4 a: source matrix A
:param Matrix4 b: source matrix B
:returns: This matrix
:rtype: :class:`Matrix4`
.. function:: Matrix4.multiplyToArray( a, b, r )
Sets this matrix to ``a * b`` and sets result into flat array ``r``
Destination array can be regular JS array or Typed Array
:param Matrix4 a: source matrix A
:param Matrix4 b: source matrix B
:param array r: destination array
:returns: This matrix
:rtype: :class:`Matrix4`
.. function:: Matrix4.multiplySelf( a )
Multiplies this matrix by ``a``
:param Matrix4 a: matrix
:returns: This matrix
:rtype: :class:`Matrix4`
.. function:: Matrix4.multiplyScalar( s )
Multiplies this matrix by ``s``
:param float a: number
:returns: This matrix
:rtype: :class:`Matrix4`
.. function:: Matrix4.multiplyVector3( v )
Applies this matrix to a :class:`Vector3`
:param Vector3 v: vector
:returns: Multiplied vector
:rtype: :class:`Vector3`
.. function:: Matrix4.multiplyVector4( v )
Applies this matrix to a :class:`Vector4`
:param Vector4 v: vector
:returns: Multiplied vector
:rtype: :class:`Vector4`
.. function:: Matrix4.rotateAxis( v )
Applies rotation submatrix of this matrix to vector ``v`` and then normalizes it
:param Vector3 v: vector
:returns: Rotated vector
:rtype: :class:`Vector3`
.. function:: Matrix4.crossVector( a )
//todo:description
:param Vector4 a: vector
:rtype: :class:`Vector4`
.. function:: Matrix4.determinant()
Computes determinant of this matrix
Based on http://www.euclideanspace.com/maths/algebra/matrix/functions/inverse/fourD/index.htm
:returns: Determinant
:rtype: float
.. function:: Matrix4.transpose()
Transposes this matrix
:returns: This matrix
:rtype: :class:`Matrix4`
.. function:: Matrix4.flatten()
Flattens this matrix into internal :attr:`Matrix4.flat` array
:returns: Flat array with this matrix values
:rtype: array
.. function:: Matrix4.flattenToArray( flat )
Flattens this matrix into supplied ``flat`` array
:param array flat: array
:returns: Flat array with this matrix values
:rtype: array
.. function:: Matrix4.flattenToArrayOffset( flat, offset )
Flattens this matrix into supplied ``flat`` array starting from ``offset`` position in the array
:param array flat: array
:param integer offset: offset
:returns: Flat array with this matrix values
:rtype: array
.. function:: Matrix4.setTranslation( x, y, z )
Sets this matrix as translation transform
:param float x: x-translation
:param float y: y-translation
:param float z: z-translation
:returns: This matrix
:rtype: :class:`Matrix4`
.. function:: Matrix4.setScale( x, y, z )
Sets this matrix as scale transform
:param float x: x-scale
:param float y: y-scale
:param float z: z-scale
:returns: This matrix
:rtype: :class:`Matrix4`
.. function:: Matrix4.setRotationX( theta )
Sets this matrix as rotation transform around x-axis by ``theta`` radians
:param float theta: Rotation angle in radians
:returns: This matrix
:rtype: :class:`Matrix4`
.. function:: Matrix4.setRotationY( theta )
Sets this matrix as rotation transform around y-axis by ``theta`` radians
:param float theta: Rotation angle in radians
:returns: This matrix
:rtype: :class:`Matrix4`
.. function:: Matrix4.setRotationZ( theta )
Sets this matrix as rotation transform around z-axis by ``theta`` radians
:param float theta: Rotation angle in radians
:returns: This matrix
:rtype: :class:`Matrix4`
.. function:: Matrix4.setRotationAxis( axis, angle )
Sets this matrix as rotation transform around ``axis`` by ``angle`` radians
Based on http://www.gamedev.net/reference/articles/article1199.asp
:param Vector3 axis: Rotation axis
:param float angle: Rotation angle in radians
:returns: This matrix
:rtype: :class:`Matrix4`
.. function:: Matrix4.setPosition( v )
Sets just position component for this matrix from vector ``v``
:param Vector3 v: position vector
:returns: This matrix
:rtype: :class:`Matrix4`
.. function:: Matrix4.getPosition()
Returns position component from this matrix
Note: this method returns a reference to internal class vector, make copy or clone if you don't use it right away.
:returns: Vector with position
:rtype: :class:`Vector3`
.. function:: Matrix4.getColumnX()
Returns x-column component from this matrix
Note: this method returns a reference to internal class vector, make copy or clone if you don't use it right away.
:returns: Vector with x-column
:rtype: :class:`Vector3`
.. function:: Matrix4.getColumnY()
Returns y-column component from this matrix
Note: this method returns a reference to internal class vector, make copy or clone if you don't use it right away.
:returns: Vector with y-column
:rtype: :class:`Vector3`
.. function:: Matrix4.getColumnZ()
Returns z-column component from this matrix
Note: this method returns a reference to internal class vector, make copy or clone if you don't use it right away.
:returns: Vector with z-column
:rtype: :class:`Vector3`
.. function:: Matrix4.getInverse( m )
Sets this matrix to inverse of matrix ``m``
Based on http://www.euclideanspace.com/maths/algebra/matrix/functions/inverse/fourD/index.htm
:param Matrix4 m: source matrix
:returns: This matrix
:rtype: :class:`Matrix4`
.. function:: Matrix4.setRotationFromEuler( v, order )
Sets rotation submatrix of this matrix to rotation specified by Euler angles
Default order ``XYZ``
:param Vector3 v: Vector3 with all the rotations
:param string order: The order of rotations eg. 'XYZ'
:returns: This matrix
:rtype: :class:`Matrix4`
.. function:: Matrix4.setRotationFromQuaternion( q )
Sets rotation submatrix of this matrix to rotation specified by quaternion
:param Quaternion q: rotation
:returns: This matrix
:rtype: :class:`Matrix4`
.. function:: Matrix4.scale( v )
Multiplies columns of this matrix by vector ``v``
:param Vector3 v: scale vector
:returns: This matrix
:rtype: :class:`Matrix4`
.. function:: Matrix4.compose( translation, rotation, scale )
Sets this matrix to transform composed of ``translation``, ``rotation`` and ``scale``
:param Vector3 translation: vector
:param Quaternion rotation: quaternion
:param Vector3 scale: vector
:returns: This matrix
:rtype: :class:`Matrix4`
.. function:: Matrix4.decompose( translation, rotation, scale )
Decomposes this matrix into `translation``, ``rotation`` and ``scale`` components
If parameters are not supplied, new instances will be created
:param Vector3 translation: destination translation vector
:param Quaternion rotation: destination rotation quaternion
:param Vector3 scale: destination scale vector
:returns: Array [ translation, rotation, scale ]
:rtype: Array
.. function:: Matrix4.extractPosition( m )
Copies translation component of supplied matrix ``m`` into this matrix translation
:param Matrix4 m: source matrix
:returns: This matrix
:rtype: :class:`Matrix4`
.. function:: Matrix4.extractRotation( m )
Copies rotation component of supplied matrix ``m`` into this matrix rotation
:param Matrix4 m: source matrix
:returns: This matrix
:rtype: :class:`Matrix4`
.. function:: Matrix4.rotateByAxis( axis, angle )
Rotates this matrix around supplied ``axis`` by ``angle``
:param Vector3 axis: rotation axis
:param float angle: rotation angle in radians
:returns: This matrix
:rtype: :class:`Matrix4`
.. function:: Matrix4.rotateX( angle )
Rotates this matrix around x-axis by ``angle``
:param float angle: rotation angle in radians
:returns: This matrix
:rtype: :class:`Matrix4`
.. function:: Matrix4.rotateY( angle )
Rotates this matrix around y-axis by ``angle``
:param float angle: rotation angle in radians
:returns: This matrix
:rtype: :class:`Matrix4`
.. function:: Matrix4.rotateZ( angle )
Rotates this matrix around z-axis by ``angle``
:param float angle: rotation angle in radians
:returns: This matrix
:rtype: :class:`Matrix4`
.. function:: Matrix4.translate( v )
Translates this matrix by vector ``v``
:param Vector3 v: translation vector
:returns: This matrix
:rtype: :class:`Matrix4`
.. ...............................................................................
.. rubric:: Static methods
.. ...............................................................................
.. function:: Matrix4.makeInvert3x3( m )
Inverts just rotation submatrix of matrix ``m``
Note: this method returns a reference to internal 3x3 matrix, make copy or clone if you don't use it right away.
Based on http://code.google.com/p/webgl-mjs/
:param Matrix4 m: source matrix
:returns: inverted submatrix
:rtype: :class:`Matrix3`
.. function:: Matrix4.makeFrustum( left, right, bottom, top, near, far )
Creates frustum matrix
:param float left: left
:param float right: right
:param float bottom: bottom
:param float top: top
:param float near: near
:param float far: far
:returns: New instance of frustum matrix
:rtype: :class:`Matrix4`
.. function:: Matrix4.makePerspective( fov, aspect, near, far )
Creates perspective projection matrix
:param float fov: vertical field of view in degrees
:param float aspect: aspect ratio
:param float near: near plane
:param float far: far plane
:returns: New instance of projection matrix
:rtype: :class:`Matrix4`
.. function:: Matrix4.makeOrtho( left, right, top, bottom, near, far )
Creates orthographic projection matrix
:param float left: left
:param float right: right
:param float top: top
:param float bottom: bottom
:param float near: near plane
:param float far: far plane
:returns: New instance of projection matrix
:rtype: :class:`Matrix4`
.. ...............................................................................
.. rubric:: Example
.. ...............................................................................
::
// simple rig for rotation around 3 axes
var m = new THREE.Matrix4();
var m1 = new THREE.Matrix4();
var m2 = new THREE.Matrix4();
var m3 = new THREE.Matrix4();
var alpha = 0;
var beta = Math.PI;
var gamma = Math.PI/2;
m1.setRotationX( alpha );
m2.setRotationY( beta );
m3.setRotationZ( gamma );
m.multiply( m1, m2 );
m.multiplySelf( m3 );
<h1>[name]</h1>
<div class="desc">todo</div>
<div class="desc">Base class for scene graph objects</div>
<h2>Constructor</h2>
......@@ -10,17 +10,178 @@
<h2>Properties</h2>
<h3>.[page:Vector3 todo]</h3>
<h3>.[page:Integer id]</h3>
<div>
Unique number of this object instance.
</div>
<h3>.[page:String name]</h3>
<div>
Optional name of the object (doesn't have to be unique).
</div>
<h3>.[page:Object3D parent]</h3>
<div>
Object's parent in scene graph.
</div>
<h3>.[page:Object3D children]</h3>
<div>
Array with object's children.
</div>
<h3>.[page:Vector3 position]</h3>
<div>
Object's local position.
</div>
<h3>.[page:Vector3 rotation]</h3>
<div>
Object's local rotation (Euler angles).
</div>
<h3>.[page:String eulerOrder]</h3>
<div>
Order of axis for Euler angles.
</div>
<h3>.[page:Vector3 scale]</h3>
<div>
Object's local scale.
</div>
<h3>.[page:Vector3 up]</h3>
<div>
Up direction.
</div>
<h3>.[page:Vector3 matrix]</h3>
<div>
Local transform.
</div>
<h3>.[page:Vector3 matrixRotationWorld]</h3>
<div>
Global rotation.
</div>
<h3>.[page:Quaternion quaternion]</h3>
<div>
Global rotation.
</div>
<h3>.[page:Boolean useQuaternion]</h3>
<div>
Use quaternion instead of Euler angles for specifying local rotation.
</div>
<h3>.[page:Float boundRadius]</h3>
<h3>.[page:Float boundRadiusScale]</h3>
<div>
Maximum scale from x, y, z scale components.
</div>
<h3>.[page:Float renderDepth]</h3>
<div>
Override depth-sorting order if non *null*.
</div>
<h3>.[page:Boolean visible]</h3>
<div>
Object gets rendered if *true*.
</div>
<h3>.[page:Boolean doubleSided]</h3>
<div>
Both sides of faces visible if *true*.
</div>
<h3>.[page:Boolean flipSided]</h3>
<div>
Backside of face visible if *true*.
</div>
<h3>.[page:Boolean castShadow]</h3>
<div>
Gets rendered into shadow map.
</div>
<h3>.[page:Boolean receiveShadow]</h3>
<div>
Material gets baked in shadow receiving.
</div>
<h3>.[page:Boolean frustumCulled]</h3>
<h3>.[page:Boolean matrixAutoUpdate]</h3>
<h3>.[page:Boolean matrixWorldNeedsUpdate]</h3>
<h3>.[page:Boolean rotationAutoUpdate]</h3>
<h2>Methods</h2>
<h3>.todo( [page:Vector3 todo] )</h3>
<h3>.translate( [page:Float distance], [page:Vector3 axis] )</h3>
<div>
distance - Distance.<br />
axis - Translation direction.
</div>
<div>
Translates object along arbitrary *axis* by *distance*.
</div>
<h3>.translateX( [page:Float distance] )</h3>
<div>
Translates object along x axis by distance.
</div>
<h3>.translateY( [page:Float distance] )</h3>
<div>
Translates object along y axis by distance.
</div>
<h3>.translateZ( [page:Float distance] )</h3>
<div>
Translates object along z axis by distance.
</div>
<h3>.lookAt( [page:Vector3 vector] )</h3>
<div>
Rotates object to face point in space.
</div>
<h3>.add( [page:Object3D object] )</h3>
<div>
Adds *object* as child of this object.
</div>
<h3>.remove( [page:Object3D object] )</h3>
<div>
Removes *object* as child of this object.
</div>
<h3>.getChildByName( [page:String name], [page:Boolean recursive] )</h3>
<div>
name - Object name.<br />
recursive - Whether check in the objects's children.
</div>
<div>
Gets first child with name matching the argument. Searches whole subgraph recursively if *recursive* is true.
</div>
<h3>.updateMatrix()</h3>
<div>
Updates local transform.
</div>
<h3>.updateMatrixWorld( [page:Boolean force] )</h3>
<div>
todo — todo<br />
Updates global transform of the object and its children.
</div>
<h2>Source</h2>
<a href="https://github.com/mrdoob/three.js/blob/master/src/[path].js" target="_blank">src/[path].js</a>
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
\ No newline at end of file
Object3D - Base class for scene graph objects
---------------------------------------------
.. ...............................................................................
.. rubric:: Constructor
.. ...............................................................................
.. class:: Object3D()
Base class for scene graph objects
.. ...............................................................................
.. rubric:: Attributes
.. ...............................................................................
.. attribute:: Object3D.id
Unique number of this object instance
.. attribute:: Object3D.name
Optional name of the object (doesn't have to be unique)
.. ...............................................................................
.. rubric:: Scene graph attributes
.. ...............................................................................
.. attribute:: Object3D.parent
Object's parent in scene graph
.. attribute:: Object3D.children
Array with object's children
.. ...............................................................................
.. rubric:: Transform attributes
.. ...............................................................................
.. attribute:: Object3D.position
Object's local position
:class:`Vector3` - default ``( 0, 0, 0 )``
.. attribute:: Object3D.rotation
Object's local rotation (Euler angles)
:class:`Vector3` - default ``( 0, 0, 0 )``
.. attribute:: Object3D.eulerOrder
Order of axis for Euler angles
``string`` - default ``XYZ``
.. attribute:: Object3D.scale
Object's local scale
:class:`Vector3` - default ``( 1, 1, 1 )``
.. attribute:: Object3D.up
Up direction
:class:`Vector3` - default ``( 0, 1, 0 )``
.. attribute:: Object3D.matrix
Local transform
:class:`Matrix4`
.. attribute:: Object3D.matrixWorld
Global transform
:class:`Matrix4`
.. attribute:: Object3D.matrixRotationWorld
Global rotation
:class:`Matrix4`
.. attribute:: Object3D.quaternion
Rotation quaternion
:class:`Quaternion`
.. attribute:: Object3D.useQuaternion
Use quaternion instead of Euler angles for specifying local rotation
boolean - default ``false``
.. attribute:: Object3D.boundRadius
``float`` - default ``0.0``
.. attribute:: Object3D.boundRadiusScale
Maximum scale from X, Y, Z scale components
``float`` - default ``1.0``
.. attribute:: Object3D.renderDepth
Override depth-sorting order if non ``null``
``float`` - default ``null``
.. ...............................................................................
.. rubric:: Appearance flags
.. ...............................................................................
.. attribute:: Object3D.visible
Object gets rendered if ``true``
``boolean`` - default ``true``
.. attribute:: Object3D.doubleSided
Both sides of faces visible if ``true``
default ``false``
.. attribute:: Object3D.flipSided
Backside of face visible
default ``false``
.. attribute:: Object3D.castShadow
Gets rendered into shadow map
``boolean`` - default ``false``
.. attribute:: Object3D.receiveShadow
Material gets baked in shadow receiving
``boolean`` - default ``false``
.. ...............................................................................
.. rubric:: Scene graph flags
.. ...............................................................................
.. attribute:: Object3D.frustumCulled
``boolean`` - default ``true``
.. attribute:: Object3D.matrixAutoUpdate
``boolean`` - default ``true``
.. attribute:: Object3D.matrixWorldNeedsUpdate
``boolean`` - default ``true``
.. attribute:: Object3D.rotationAutoUpdate
``boolean`` - default ``true``
.. ...............................................................................
.. rubric:: Methods
.. ...............................................................................
.. function:: Object3D.translate ( distance, axis )
Translates object along arbitrary axis by distance
:param float distance: distance
:param Vector3 axis: translation direction
.. function:: Object3D.translateX ( distance )
Translates object along X-axis by distance
:param float distance: distance
.. function:: Object3D.translateY ( distance )
Translates object along Y-axis by distance
:param float distance: distance
.. function:: Object3D.translateZ ( distance )
Translates object along Z-axis by distance
:param float distance: distance
.. function:: Object3D.lookAt ( vector )
Rotates object to face point in space
:param Vector3 vector: vector
.. function:: Object3D.add ( object )
Adds child object to this object
:param Object3D object: child
.. function:: Object3D.remove ( object )
Removes child object from this object
:param Object3D object: child
.. function:: Object3D.getChildByName ( name, doRecurse )
Gets first child with name matching the argument (searches whole subgraph recursively if flag is set).
:param string name: child name
:param boolean doRecurse: recurse flag
:returns: child with matching name or ``undefined``
:rtype: :class:`Object3D`
.. function:: Object3D.updateMatrix ( )
Updates local transform
.. function:: Object3D.updateMatrixWorld ( force )
Updates global transform of the object and its children
.. ...............................................................................
.. rubric:: Example
.. ...............................................................................
<h1>[name]</h1>
<div class="desc">Projecting points between spaces.</div>
<div class="desc">Projects points between spaces.</div>
<h2>Constructor</h2>
......@@ -8,19 +8,22 @@
<h3>[name]()</h3>
<h2>Properties</h2>
<h3>.[page:Vector3 todo]</h3>
<h2>Methods</h2>
<h3>.projectVector( [page:Vector3 vector], [page:Camera camera] ) [page:Vector3]</h3>
<h2>Methods</h2>
<h3>.unprojectVector( [page:Vector3 vector], [page:Camera camera] ) [page:Vector3]</h3>
<h3>.todo( [page:Vector3 todo] )</h3>
<h3>.pickingRay( [page:Vector3 vector], [page:Camera camera] ) [page:Ray]</h3>
<div>
todo — todo<br />
Translates a 2D point from NDC to a [page:Ray] that can be used for picking.
</div>
<h3>.projectGraph( [page:Object3D root], [page:Boolean sort] ) [page:Object]</h3>
<h3>.projectScene( [page:Scene scene], [page:Camera camera], [page:Boolean sort] ) [page:Object]</h3>
<h2>Source</h2>
<a href="https://github.com/mrdoob/three.js/blob/master/src/[path].js" target="_blank">src/[path].js</a>
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
\ No newline at end of file
<h1>[name]</h1>
<div class="desc">todo</div>
<div class="desc">Implementation of a quaternion</div>
<h2>Example</h2>
<code>var q = new THREE.Quaternion();
q.setFromAxisAngle( new THREE.Vector3( 0, 1, 0 ), Math.PI / 2 );
var v = new THREE.Vector3( 1, 0, 0 );
q.multiplyVector3( v );
</code>
<h2>Constructor</h2>
<h3>[name]()</h3>
<h3>[name]( [page:Float x], [page:Float y], [page:Float z], [page:Float w] )</h3>
<div>
x - x coordinate<br />
y - y coordinate<br />
z - z coordinate<br />
w - w coordinate
</div>
<h2>Properties</h2>
<h3>.[page:Vector3 todo]</h3>
<h3>.[page:Float x]</h3>
<h3>.[page:Float y]</h3>
<h3>.[page:Float z]</h3>
<h3>.[page:Float w]</h3>
<h2>Methods</h2>
<h3>.todo( [page:Vector3 todo] )</h3>
<h3>.set( [page:Float x], [page:Float y], [page:Float z], [page:Float w] ) [page:Quaternion]</h3>
<div>
Sets values of this quaternion.
</div>
<h3>.copy( [page:Quaternion q] ) [page:Quaternion]</h3>
<div>
Copies values of *q* to this quaternion.
</div>
<h3>.setFromEuler( [page:Vector3 vector] ) [page:Quaternion]</h3>
<div>
Sets this quaternion from rotation specified by Euler angles.
</div>
<h3>.setFromAxisAngle( [page:Vector3 axis], [page:Float angle] ) [page:Quaternion]</h3>
<div>
Sets this quaternion from rotation specified by axis and angle.<br />
Adapted from [link:http://www.euclideanspace.com/maths/geometry/rotations/conversions/angleToQuaternion/index.htm].<br />
*Axis* have to be normalized, *angle* is in radians.
</div>
<h3>.setFromRotationMatrix( [page:Matrix4 m] ) [page:Quaternion]</h3>
<div>
Sets this quaternion from rotation component of *m*.
Adapted from [link:http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToQuaternion/index.htm].
</div>
<h3>.calculateW() [page:Quaternion]</h3>
<div>
Calculates *w* component of this quaternion.
</div>
<h3>.inverse() [page:Quaternion]</h3>
<div>
Inverts this quaternion.
</div>
<h3>.length() [page:Float]</h3>
<div>
Computes length of this quaternion.
</div>
<h3>.normalize() [page:Quaternion]</h3>
<div>
Normalizes this quaternion.
</div>
<h3>.multiply( [page:Quaternion a], [page:Quaternion b] ) [page:Quaternion]</h3>
<div>
Sets this quaternion to *a x b*<br />
Adapted from [link:http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/code/index.htm].
</div>
<h3>.multiplySelf( [page:Quaternion b] ) [page:Quaternion]</h3>
<div>
Multiplies this quaternion by *b*.
</div>
<h3>.multiplyVector3( [page:Vector3 vector], [page:Vector3 dest] ) [page:Quaternion]</h3>
<div>
Rotates *vector* by this quaternion into *dest*.<br />
If *dest* is not specified, result goes to *vec*.
</div>
<h3>.clone() [page:Quaternion]</h3>
<div>
Clones this quaternion.
</div>
<h2>Static methods</h2>
<h3>.slerp( [page:Quaternion qa], [page:Quaternion qb], [page:Quaternion qm], [page:Float t] ) [page:Quaternion]</h3>
<div>
todo — todo<br />
Adapted from [link:http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/slerp/].
</div>
<h2>Source</h2>
<a href="https://github.com/mrdoob/three.js/blob/master/src/[path].js" target="_blank">src/[path].js</a>
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
\ No newline at end of file
Quaternion - Implementation of a quaternion
-------------------------------------------
.. ...............................................................................
.. rubric:: Constructor
.. ...............................................................................
.. class:: Quaternion( x, y, z, w )
Implementation of a quaternion
:param float x: x-coordinate
:param float y: y-coordinate
:param float z: z-coordinate
:param float w: w-coordinate
.. ...............................................................................
.. rubric:: Attributes
.. ...............................................................................
.. attribute:: Quaternion.x
float - default ``0``
.. attribute:: Quaternion.y
float - default ``0``
.. attribute:: Quaternion.z
float - default ``0``
.. attribute:: Quaternion.w
float - default ``1``
.. ...............................................................................
.. rubric:: Methods
.. ...............................................................................
.. function:: Quaternion.clone( )
Clones this quaternion
:returns: New instance identical to this quaternion
:rtype: :class:`Quaternion`
.. function:: Quaternion.set( x, y, z, w )
Sets value of this vector
:param float x: x-coordinate
:param float y: y-coordinate
:param float z: z-coordinate
:param float w: w-coordinate
:returns: This quaternion
:rtype: :class:`Quaternion`
.. function:: Quaternion.copy( q )
Copies value of ``q`` to this quaternion
:param Quaternion v: source quaternion
:returns: This quaternion
:rtype: :class:`Quaternion`
.. function:: Quaternion.setFromEuler ( vec3 )
Sets this quaternion from rotation specified by Euler angles
Angles are in degrees
:param Vector3 vec3: Euler angles vector
:returns: This quaternion
:rtype: :class:`Quaternion`
.. function:: Quaternion.setFromAxisAngle ( axis, angle )
Sets this quaternion from rotation specified by axis and angle
Adapted from: http://www.euclideanspace.com/maths/geometry/rotations/conversions/angleToQuaternion/index.htm
Axis have to be normalized, angle is in radians
:param Vector3 axis: axis vector
:param float angle: angle
:returns: This quaternion
:rtype: :class:`Quaternion`
.. function:: Quaternion.setFromRotationMatrix ( m )
Sets this quaternion from rotation specified by matrix
Adapted from: http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToQuaternion/index.htm
:param Matrix4 m: rotation matrix
:returns: This quaternion
:rtype: :class:`Quaternion`
.. function:: Quaternion.calculateW( )
Calculates ``w`` component of this quaternion
:returns: This quaternion
:rtype: :class:`Quaternion`
.. function:: Quaternion.inverse( )
Inverts this quaternion
:returns: This quaternion
:rtype: :class:`Quaternion`
.. function:: Quaternion.length( )
Computes length of this quaternion
:returns: length
:rtype: float
.. function:: Quaternion.normalize( )
Normalizes this quaternion
:returns: This vector
:rtype: :class:`Quaternion`
.. function:: Quaternion.multiplySelf( quat2 )
Multiplies this quaternion by ``quat2``
:param Quaternion quat2: quaternion
:returns: This quaternion
:rtype: :class:`Quaternion`
.. function:: Quaternion.multiply( q1, q2 )
Sets this quaternion to ``q1 * q2``
Adapted from: http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/code/index.htm
:param Quaternion q1: quaternion 1
:param Quaternion q2: quaternion 2
:returns: This quaternion
:rtype: :class:`Quaternion`
.. function:: Quaternion.multiplyVector3( vec, dest )
Rotates ``vec`` by this quaternion into ``dest``
If ``dest`` is not specified, result goes to ``vec``
:param Vector3 vec: source vector
:param Vector3 dest: destination vector
:returns: Rotated vector
:rtype: :class:`Vector3`
.. ...............................................................................
.. rubric:: Example
.. ...............................................................................
::
var q = new THREE.Quaternion();
q.setFromAxisAngle( new THREE.Vector3( 0, 1, 0 ), Math.PI / 2 );
var v = new THREE.Vector3( 1, 0, 0 );
q.multiplyVector3( v );
......@@ -10,17 +10,20 @@
<h2>Properties</h2>
<h3>.[page:Vector3 todo]</h3>
<h3>.[page:Vector3 origin]</h3>
<h3>.[page:Vector3 direction]</h3>
<h2>Methods</h2>
<h3>.todo( [page:Vector3 todo] )</h3>
<div>
todo — todo<br />
</div>
<h3>.setPrecision( [page:Float value] )</h3>
<h3>.intersectObject( [page:Object3D object] ) [page:Object]</h3>
<h3>.intersectObjects( [page:Array objects] ) [page:Array]</h3>
<h2>Source</h2>
<a href="https://github.com/mrdoob/three.js/blob/master/src/[path].js" target="_blank">src/[path].js</a>
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
\ No newline at end of file
<h1>[name]</h1>
<div class="desc">Represents a 2D rectangle.</div>
<div class="desc">
Mainly used internaly by [page:CanvasRenderer] for 2D clipping.
</div>
<h2>Constructor</h2>
......@@ -8,19 +10,46 @@
<h3>[name]()</h3>
<h2>Properties</h2>
<h2>Methods</h2>
<h3>.getX() [page:Float]</h3>
<h3>.[page:Vector3 todo]</h3>
<h3>.getY() [page:Float]</h3>
<h3>.getWidth() [page:Float]</h3>
<h2>Methods</h2>
<h3>.getHeight() [page:Float]</h3>
<h3>.getLeft() [page:Float]</h3>
<h3>.getTop() [page:Float]</h3>
<h3>.getRight() [page:Float]</h3>
<h3>.getBottom() [page:Float]</h3>
<h3>.todo( [page:Vector3 todo] )</h3>
<h3>.set( [page:Float left], [page:Float top], [page:Float right], [page:Float bottom] )</h3>
<h3>.addPoint( [page:Float x], [page:Float y] )</h3>
<h3>.add3Points( [page:Float x1], [page:Float y1], [page:Float x2], [page:Float y2], [page:Float x3], [page:Float y3] )</h3>
<h3>.addRectangle( [page:Rectangle r] )</h3>
<h3>.inflate( [page:Float v] )</h3>
<h3>.minSelf( [page:Rectangle r] )</h3>
<h3>.intersects( [page:Rectangle r] ) [page:Boolean]</h3>
<div>
todo — todo<br />
Adapted from [link:http://gamemath.com/2011/09/detecting-whether-two-boxes-overlap/].
</div>
<h3>.empty()</h3>
<h3>.isEmpty() [page:Boolean]</h3>
<h2>Source</h2>
<a href="https://github.com/mrdoob/three.js/blob/master/src/[path].js" target="_blank">src/[path].js</a>
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
\ No newline at end of file
......@@ -23,4 +23,4 @@ todo — todo<br />
<h2>Source</h2>
<a href="https://github.com/mrdoob/three.js/blob/master/src/[path].js" target="_blank">src/[path].js</a>
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
\ No newline at end of file
......@@ -40,4 +40,4 @@ Vertical coordinate.<br />
<h2>Source</h2>
<a href="https://github.com/mrdoob/three.js/blob/master/src/[path].js" target="_blank">src/[path].js</a>
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
\ No newline at end of file
<h1>[name]</h1>
<div class="desc">todo</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 d = a.distanceTo( b );
</code>
<h2>Constructor</h2>
<h3>[name]()</h3>
<h3>[name]( [page:Float x], [page:Float y] )</h3>
<h2>Properties</h2>
<h3>.[page:Vector3 todo]</h3>
<h3>.[page:Float x]</h3>
<h3>.[page:Float y]</h3>
<h2>Methods</h2>
<h3>.todo( [page:Vector3 todo] )</h3>
<h3>.set( [page:Float x], [page:Float y] ) [page:Vector2]</h3>
<div>
Sets value of this vector.
</div>
<h3>.copy( [page:Vector2 v] ) [page:Vector2]</h3>
<div>
Copies value of *v* to this vector.
</div>
<h3>.add( [page:Vector2 a], [page:Vector2 b] ) [page:Vector2]</h3>
<div>
Sets this vector to *a + b*.
</div>
<h3>.addSelf( [page:Vector2 v] ) [page:Vector2]</h3>
<div>
Adds *v* to this vector.
</div>
<h3>.sub( [page:Vector2 a], [page:Vector2 b] ) [page:Vector2]</h3>
<div>
Sets this vector to *a - b*.
</div>
<h3>.subSelf( [page:Vector2 v] ) [page:Vector2]</h3>
<div>
Subtracts *v* from this vector.
</div>
<h3>.multiplyScalar( [page:Float s] ) [page:Vector2]</h3>
<div>
Multiplies this vector by scalar *s*.
</div>
<h3>.divideScalar( [page:Float s] ) [page:Vector2]</h3>
<div>
Divides this vector by scalar *s*.<br />
Set vector to *( 0, 0 )* if *s == 0*.
</div>
<h3>.negate() [page:Vector2]</h3>
<div>
Inverts this vector.
</div>
<h3>.dot( [page:Vector2 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>.normalize() [page:Vector2]</h3>
<div>
Normalizes this vector.
</div>
<h3>.distanceTo( [page:Vector2 v] ) [page:Float]</h3>
<div>
Computes distance of this vector to *v*.
</div>
<h3>.distanceToSquared( [page:Vector2 v] ) [page:Float]</h3>
<div>
Computes squared distance of this vector to *v*.
</div>
<h3>.setLength( [page:Float l] ) [page:Vector2]</h3>
<div>
Normalizes this vector and multiplies it by *l*.
</div>
<h3>.equals( [page:Vector2 v] ) [page:Vector2]</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:Vector2]</h3>
<div>
todo — todo<br />
Clones this vector.
</div>
<h2>Source</h2>
<a href="https://github.com/mrdoob/three.js/blob/master/src/[path].js" target="_blank">src/[path].js</a>
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
\ No newline at end of file
Vector2 - 2D vector
-------------------
.. ...............................................................................
.. rubric:: Constructor
.. ...............................................................................
.. class:: Vector2( x, y )
2D vector
:param float x: x-coordinate
:param float y: y-coordinate
.. ...............................................................................
.. rubric:: Attributes
.. ...............................................................................
.. attribute:: Vector2.x
float - default ``0``
.. attribute:: Vector2.y
float - default ``0``
.. ...............................................................................
.. rubric:: Methods
.. ...............................................................................
.. function:: Vector2.clone( )
Clones this vector
:returns: New instance identical to this vector
:rtype: :class:`Vector2`
.. function:: Vector2.set( x, y )
Sets value of this vector
:param float x: x-coordinate
:param float y: y-coordinate
:returns: This vector
:rtype: :class:`Vector2`
.. function:: Vector2.copy( v )
Copies value of ``v`` to this vector
:param Vector2 v: source vector
:returns: This vector
:rtype: :class:`Vector2`
.. function:: Vector2.add( v1, v2 )
Sets this vector to ``v1 + v2``
:param Vector2 v1: source vector 1
:param Vector2 v2: source vector 2
:returns: This vector
:rtype: :class:`Vector2`
.. function:: Vector2.addSelf( v )
Adds ``v`` to this vector
:param Vector2 v: source vector
:returns: This vector
:rtype: :class:`Vector2`
.. function:: Vector2.sub( v1, v2 )
Sets this vector to ``v1 - v2``
:param Vector2 v1: source vector 1
:param Vector2 v2: source vector 2
.. function:: Vector2.subSelf( v )
Subtracts ``v`` from this vector
:param Vector2 v: source vector
:returns: This vector
:rtype: :class:`Vector2`
.. function:: Vector2.multiplyScalar( s )
Multiplies this vector by scalar ``s``
:param float s: scalar
:returns: This vector
:rtype: :class:`Vector2`
.. function:: Vector2.divideScalar( s )
Divides this vector by scalar ``s``
Set vector to ``( 0, 0 )`` if ``s == 0``
:param float s: scalar
:returns: This vector
:rtype: :class:`Vector2`
.. function:: Vector2.negate( )
Inverts this vector
:returns: This vector
:rtype: :class:`Vector2`
.. function:: Vector2.dot( v )
Computes dot product of this vector and ``v``
:returns: dot product
:rtype: float
.. function:: Vector2.lengthSq( )
Computes squared length of this vector
:returns: squared length
:rtype: float
.. function:: Vector2.length( )
Computes length of this vector
:returns: length
:rtype: float
.. function:: Vector2.normalize( )
Normalizes this vector
:returns: This vector
:rtype: :class:`Vector2`
.. function:: Vector2.distanceTo( v )
Computes distance of this vector to ``v``
:returns: squared distance
:rtype: float
.. function:: Vector2.distanceToSquared( v )
Computes squared distance of this vector to ``v``
:returns: squared distance
:rtype: float
.. function:: Vector2.setLength( l )
Normalizes this vector and multiplies it by ``l``
:returns: This vector
:rtype: :class:`Vector2`
.. function:: Vector2.equals( v )
Checks for strict equality of this vector and ``v``
:returns: true if this vector equals ``v``
:rtype: boolean
.. function:: Vector2.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.Vector2( 0, 1 );
var b = new THREE.Vector2( 1, 0 );
var d = a.distanceTo( b );
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
<h1>[name]</h1>
<div class="desc"></div>
<h2>Constructor</h2>
<h3>[name]()</h3>
<h2>Properties</h2>
<h3>.[page:Vector3 position]</h3>
<h2>Source</h2>
<a href="https://github.com/mrdoob/three.js/blob/master/src/[path].js" target="_blank">src/[path].js</a>
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
......@@ -23,4 +23,4 @@ todo — todo<br />
<h2>Source</h2>
<a href="https://github.com/mrdoob/three.js/blob/master/src/[path].js" target="_blank">src/[path].js</a>
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
\ No newline at end of file
......@@ -23,4 +23,4 @@ todo — todo<br />
<h2>Source</h2>
<a href="https://github.com/mrdoob/three.js/blob/master/src/[path].js" target="_blank">src/[path].js</a>
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
\ No newline at end of file
此差异已折叠。
此差异已折叠。
此差异已折叠。
......@@ -23,4 +23,4 @@ todo — todo<br />
<h2>Source</h2>
<a href="https://github.com/mrdoob/three.js/blob/master/src/[path].js" target="_blank">src/[path].js</a>
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
\ No newline at end of file
此差异已折叠。
此差异已折叠。
......@@ -23,4 +23,4 @@ todo — todo<br />
<h2>Source</h2>
<a href="https://github.com/mrdoob/three.js/blob/master/src/[path].js" target="_blank">src/[path].js</a>
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
\ No newline at end of file
......@@ -23,4 +23,4 @@ todo — todo<br />
<h2>Source</h2>
<a href="https://github.com/mrdoob/three.js/blob/master/src/[path].js" target="_blank">src/[path].js</a>
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
\ No newline at end of file
此差异已折叠。
......@@ -23,4 +23,4 @@ todo — todo<br />
<h2>Source</h2>
<a href="https://github.com/mrdoob/three.js/blob/master/src/[path].js" target="_blank">src/[path].js</a>
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
\ No newline at end of file
......@@ -23,4 +23,4 @@ todo — todo<br />
<h2>Source</h2>
<a href="https://github.com/mrdoob/three.js/blob/master/src/[path].js" target="_blank">src/[path].js</a>
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
\ No newline at end of file
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册