123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="utf-8" />
- <script src="../../list.js"></script>
- <script src="../../page.js"></script>
- <link type="text/css" rel="stylesheet" href="../../page.css" />
- </head>
- <body>
- <h1>[name]</h1>
- <div class="desc">Implementation of a <a href="http://en.wikipedia.org/wiki/Quaternion">quaternion</a>. This is used for rotating things without encountering the dreaded <a href="http://en.wikipedia.org/wiki/Gimbal_lock">gimbal lock</a> issue, amongst other advantages.</div>
- <h2>Example</h2>
- <code>var quaternion = new THREE.Quaternion();
- quaternion.setFromAxisAngle( new THREE.Vector3( 0, 1, 0 ), Math.PI / 2 );
- var vector = new THREE.Vector3( 1, 0, 0 );
- vector.applyQuaternion( quaternion );
- </code>
- <h2>Constructor</h2>
- <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:Float x]</h3>
- <h3>.[page:Float y]</h3>
- <h3>.[page:Float z]</h3>
- <h3>.[page:Float w]</h3>
- <h2>Methods</h2>
- <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>.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 b] ) [page:Quaternion]</h3>
- <div>
- Multiplies this quaternion by *b*.
- </div>
- <h3>.multiplyQuaternions( [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>.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>
- Adapted from [link:http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/slerp/].
- </div>
- <h3>.slerp([page:todo qb], [page:todo t]) [page:todo]</h3>
- <div>
- qb -- todo <br />
- t -- todo
- </div>
- <div>
- todo
- </div>
- <h3>.toArray() [page:todo]</h3>
- <div>
- todo
- </div>
- <h3>.equals([page:todo v]) [page:todo]</h3>
- <div>
- v -- todo
- </div>
- <div>
- todo
- </div>
- <h3>.lengthSq() [page:todo]</h3>
- <div>
- todo
- </div>
- <h3>.fromArray([page:todo array]) [page:todo]</h3>
- <div>
- array -- todo
- </div>
- <div>
- todo
- </div>
- <h3>.conjugate() [page:todo]</h3>
- <div>
- todo
- </div>
- <h2>Source</h2>
- [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
- </body>
- </html>
|