Euler.html 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8" />
  5. <base href="../../" />
  6. <script src="list.js"></script>
  7. <script src="page.js"></script>
  8. <link type="text/css" rel="stylesheet" href="page.css" />
  9. </head>
  10. <body>
  11. <h1>[name]</h1>
  12. <div class="desc">
  13. A class representing [link:http://en.wikipedia.org/wiki/Euler_angles Euler Angles].<br /><br />
  14. Euler angles describe a rotational transformation by rotating an object on its various
  15. axes in specified amounts per axis, and a specified axis order.
  16. </div>
  17. <h2>Example</h2>
  18. <code>var a = new THREE.Euler( 0, 1, 1.57, 'XYZ' );
  19. var b = new THREE.Vector3( 1, 0, 1 );
  20. b.applyEuler(a);
  21. </code>
  22. <h2>Constructor</h2>
  23. <h3>[name]( [page:Float x], [page:Float y], [page:Float z], [page:String order] )</h3>
  24. <div>
  25. [page:Float x] - (optional) the angle of the x axis in radians. Default is *0*.<br />
  26. [page:Float y] - (optional) the angle of the y axis in radians. Default is *0*.<br />
  27. [page:Float z] - (optional) the angle of the z axis in radians. Default is *0*.<br />
  28. [page:String order] - (optional) a string representing the order that the rotations are applied,
  29. defaults to 'XYZ' (must be upper case).<br /><br />
  30. </div>
  31. <h2>Properties</h2>
  32. <h3>[property:Boolean isEuler]</h3>
  33. <div>
  34. Used to check whether this or derived classes are Eulers. Default is *true*.<br /><br />
  35. You should not change this, as it used internally for optimisation.
  36. </div>
  37. <h3>[property:String order]</h3>
  38. <div>
  39. The order in which to apply rotations. Default is 'XYZ', which means that the object will first be
  40. rotated around its X axis, then its Y axis and finally its Z axis. Other possibilities are:
  41. 'YZX', 'ZXY', 'XZY', 'YXZ' and 'ZYX'. These must be in upper case.<br /><br />
  42. Three.js uses <em>intrinsic</em> (Tait-Bryan) ordering, also known as <em>yaw</em>, <em>pitch</em>
  43. and <em>roll</em>. This means that rotations are performed with respect to the <em>local</em>
  44. coordinate system. That is, for order 'XYZ', the rotation is first around world-X, then around
  45. local-Y (which may now be different from the world Y-axis), then local-Z (which may be different
  46. from the world Z-axis).<br /><br />
  47. Some implementations may use <em>extrinsic</em> (proper) ordering, in which case rotations are performed
  48. with respect to the <em>world</em> coordinate system, so that for order 'XYZ', the rotations
  49. are around world-X, world-Y, and world-Z.<br /><br />
  50. Converting between the two types is relatively straightforward, you just need to reverse the order
  51. and the rotation, so that an intrinsic (three.js) Euler rotation of angles a, b, c about XYZ
  52. will be equivalent to to an extrinsic Euler rotation of angles c, b, a about ZYX.<br /><br />
  53. If the order is changed, [page:.onChangeCallback onChangeCallback] will be called.
  54. </div>
  55. <h3>[property:Float x]</h3>
  56. <div>
  57. The current value of the x component.<br /><br />
  58. If this is changed, [page:.onChangeCallback onChangeCallback] will be called.
  59. </div>
  60. <h3>[property:Float y]</h3>
  61. <div>
  62. The current value of the y component.<br /><br />
  63. If this is changed, [page:.onChangeCallback onChangeCallback] will be called.
  64. </div>
  65. <h3>[property:Float z]</h3>
  66. <div>
  67. The current value of the z component.<br /><br />
  68. If this is changed, [page:.onChangeCallback onChangeCallback] will be called.
  69. </div>
  70. <h2>Methods</h2>
  71. <h3>[method:Euler copy]( [page:Euler euler] )</h3>
  72. <div>Copies value of [page:Euler euler] to this euler.</div>
  73. <h3>[method:Euler clone]()</h3>
  74. <div>Returns a new Euler with the same parameters as this one.</div>
  75. <h3>[method:Boolean equals]( [page:Euler euler] )</h3>
  76. <div>Checks for strict equality of this euler and [page:Euler euler].</div>
  77. <h3>[method:Euler fromArray]( [page:Array array] )</h3>
  78. <div>
  79. [page:Array array] of length 3 or 4. The optional 4th argument corresponds to the [page:.order order].<br /><br />
  80. Assigns this euler's [page:.x x] angle to array[0]. <br />
  81. Assigns this euler's [page:.y y] angle to array[1]. <br />
  82. Assigns this euler's [page:.z z] angle to array[2]. <br />
  83. Optionally assigns this euler's [page:.order order] to array[3].
  84. </div>
  85. <h3>[method:Euler onChange]( [page:Function onChangeCallback] )</h3>
  86. <div>
  87. [page:Function onChangeCallback] - set the value of the onChangeCallback() function.
  88. </div>
  89. <h3>[method:Euler onChangeCallback]( )</h3>
  90. <div>
  91. By default this is an empty function, however it can be set via [page:.onChange onChange]().<br />
  92. It gets called after changing the [page:.x x], [page:.y y], [page:.z z] or [page:.order order] properties,
  93. and also after calling most setter functions (see those for details).
  94. </div>
  95. <h3>[method:Euler reorder]( [page:String newOrder] )</h3>
  96. <div>
  97. Resets the euler angle with a new order by creating a quaternion from this euler angle
  98. and then setting this euler angle with the quaternion and the new order. <br /><br />
  99. <em>WARNING</em>: this discards revolution information.
  100. </div>
  101. <h3>[method:Euler set]( [page:Float x], [page:Float y], [page:Float z], [page:String order] )</h3>
  102. <div>
  103. [page:.x x] - the angle of the x axis in radians.<br />
  104. [page:.y y] - the angle of the y axis in radians.<br />
  105. [page:.z z] - the angle of the z axis in radians.<br />
  106. [page:.order order] - (optional) a string representing the order that the rotations are applied.<br /><br />
  107. Sets the angles of this euler transform and optionally the [page:.order order] and then call [page:.onChangeCallback onChangeCallback]().
  108. </div>
  109. <h3>[method:Euler setFromRotationMatrix]( [page:Matrix4 m], [page:String order], [page:Boolean update] )</h3>
  110. <div>
  111. [page:Matrix4 m] - a [page:Matrix4] of which the upper 3x3 of matrix is a pure
  112. [link:https://en.wikipedia.org/wiki/Rotation_matrix rotation matrix] (i.e. unscaled).<br />
  113. [page:.order order] - (optional) a string representing the order that the rotations are applied.<br />
  114. [page:Boolean update] - (optional) whether to call [page:.onChangeCallback onChangeCallback]() after applying
  115. the matrix.<br /><br />
  116. Sets the angles of this euler transform from a pure rotation matrix based on the orientation
  117. specified by order.
  118. </div>
  119. <h3>[method:Euler setFromQuaternion]( [page:Quaternion q], [page:String order], [page:Boolean update] )</h3>
  120. <div>
  121. [page:Quaternion q] - a normalized quaternion.<br />
  122. [page:.order order] - (optional) a string representing the order that the rotations are applied.<br />
  123. [page:Boolean update] - (optional) whether to call [page:.onChangeCallback onChangeCallback]() after applying
  124. the matrix.<br /><br />
  125. Sets the angles of this euler transform from a normalized quaternion based on the orientation
  126. specified by [page:.order order].
  127. </div>
  128. <h3>[method:Euler setFromVector3]( [page:Vector3 vector], [page:String order] )</h3>
  129. <div>
  130. [page:Vector3 vector] - [page:Vector3].<br />
  131. [page:.order order] - (optional) a string representing the order that the rotations are applied.<br /><br />
  132. Set the [page:.x x], [page:.y y] and [page:.z z], and optionally update the [page:.order order]. [page:.onChangeCallback onChangeCallback]()
  133. is called after these changes are made.
  134. </div>
  135. <h3>[method:Array toArray]( [page:Array array], [page:Integer offset] )</h3>
  136. <div>
  137. [page:Array array] - (optional) array to store the euler in.<br />
  138. [page:Integer offset] (optional) offset in the array.<br />
  139. Returns an array of the form [[page:.x x], [page:.y y], [page:.z z], [page:.order order ]].
  140. </div>
  141. <h3>[method:Vector3 toVector3]()</h3>
  142. <div>Returns the Euler's [page:.x x], [page:.y y] and [page:.z z] properties as a [page:Vector3].</div>
  143. <h2>Source</h2>
  144. [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
  145. </body>
  146. </html>