Euler.html 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>Euler - Three.js Docs</title>
  6. <meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
  7. <script src="../scripts/highlight.min.js"></script>
  8. <link type="text/css" rel="stylesheet" href="../styles/highlight-three.css">
  9. <link type="text/css" rel="stylesheet" href="../styles/page.css">
  10. </head>
  11. <body>
  12. <h1 translate="no">Euler</h1>
  13. <section>
  14. <header>
  15. <div class="class-description"><p>A class representing Euler angles.</p>
  16. <p>Euler angles describe a rotational transformation by rotating an object on
  17. its various axes in specified amounts per axis, and a specified axis
  18. order.</p>
  19. <p>Iterating through an instance will yield its components (x, y, z,
  20. order) in the corresponding order.</p></div>
  21. <h2>Code Example</h2>
  22. <div translate="no"><pre><code class="language-js">const a = new THREE.Euler( 0, 1, 1.57, 'XYZ' );
  23. const b = new THREE.Vector3( 1, 0, 1 );
  24. b.applyEuler(a);
  25. </code></pre></div>
  26. </header>
  27. <article>
  28. <div class="container-overview">
  29. <h2>Constructor</h2>
  30. <h3 class="name name-method" id="Euler" translate="no">new <a href="#Euler">Euler</a><span class="signature">( x : <span class="param-type">number</span>, y : <span class="param-type">number</span>, z : <span class="param-type">number</span>, order : <span class="param-type">string</span> )</span> </h3>
  31. <div class="method">
  32. <div class="description">
  33. <p>Constructs a new euler instance.</p>
  34. </div>
  35. <table class="params">
  36. <tbody>
  37. <tr>
  38. <td class="name"><code>x</code></td>
  39. <td class="description last"><p>The angle of the x axis in radians.<br/>Default is <code>0</code>.</p></td>
  40. </tr>
  41. <tr>
  42. <td class="name"><code>y</code></td>
  43. <td class="description last"><p>The angle of the y axis in radians.<br/>Default is <code>0</code>.</p></td>
  44. </tr>
  45. <tr>
  46. <td class="name"><code>z</code></td>
  47. <td class="description last"><p>The angle of the z axis in radians.<br/>Default is <code>0</code>.</p></td>
  48. </tr>
  49. <tr>
  50. <td class="name"><code>order</code></td>
  51. <td class="description last"><p>A string representing the order that the rotations are applied.<br/>Default is <code>Euler.DEFAULT_ORDER</code>.</p></td>
  52. </tr>
  53. </tbody>
  54. </table>
  55. </div>
  56. </div>
  57. <h2 class="subsection-title">Properties</h2>
  58. <div class="member">
  59. <h3 class="name" id="isEuler" translate="no">.<a href="#isEuler">isEuler</a><span class="type-signature"> : boolean</span> <span class="type-signature">(readonly) </span></h3>
  60. <div class="description">
  61. <p>This flag can be used for type testing.<br/>Default is <code>true</code>.</p>
  62. </div>
  63. </div>
  64. <div class="member">
  65. <h3 class="name" id="order" translate="no">.<a href="#order">order</a><span class="type-signature"> : string</span> </h3>
  66. <div class="description">
  67. <p>A string representing the order that the rotations are applied.<br/>Default is <code>'XYZ'</code>.</p>
  68. </div>
  69. </div>
  70. <div class="member">
  71. <h3 class="name" id="x" translate="no">.<a href="#x">x</a><span class="type-signature"> : number</span> </h3>
  72. <div class="description">
  73. <p>The angle of the x axis in radians.<br/>Default is <code>0</code>.</p>
  74. </div>
  75. </div>
  76. <div class="member">
  77. <h3 class="name" id="y" translate="no">.<a href="#y">y</a><span class="type-signature"> : number</span> </h3>
  78. <div class="description">
  79. <p>The angle of the y axis in radians.<br/>Default is <code>0</code>.</p>
  80. </div>
  81. </div>
  82. <div class="member">
  83. <h3 class="name" id="z" translate="no">.<a href="#z">z</a><span class="type-signature"> : number</span> </h3>
  84. <div class="description">
  85. <p>The angle of the z axis in radians.<br/>Default is <code>0</code>.</p>
  86. </div>
  87. </div>
  88. <div class="member">
  89. <h3 class="name" id=".DEFAULT_ORDER" translate="no">.<a href="#.DEFAULT_ORDER">DEFAULT_ORDER</a><span class="type-signature"> : string</span> </h3>
  90. <div class="description">
  91. <p>The default Euler angle order.<br/>Default is <code>'XYZ'</code>.</p>
  92. </div>
  93. </div>
  94. <h2 class="subsection-title">Methods</h2>
  95. <h3 class="name name-method" id="clone" translate="no">.<a href="#clone">clone</a><span class="signature">()</span><span class="type-signature"> : <a href="Euler.html">Euler</a></span> </h3>
  96. <div class="method">
  97. <div class="description">
  98. <p>Returns a new Euler instance with copied values from this instance.</p>
  99. </div>
  100. <dl class="details">
  101. <dt class="tag-returns"><strong>Returns:</strong> A clone of this instance.</dt>
  102. </dl>
  103. </div>
  104. <h3 class="name name-method" id="copy" translate="no">.<a href="#copy">copy</a><span class="signature">( euler : <span class="param-type">Euler</span> )</span><span class="type-signature"> : <a href="Euler.html">Euler</a></span> </h3>
  105. <div class="method">
  106. <div class="description">
  107. <p>Copies the values of the given Euler instance to this instance.</p>
  108. </div>
  109. <table class="params">
  110. <tbody>
  111. <tr>
  112. <td class="name"><code>euler</code></td>
  113. <td class="description last"><p>The Euler instance to copy.</p></td>
  114. </tr>
  115. </tbody>
  116. </table>
  117. <dl class="details">
  118. <dt class="tag-returns"><strong>Returns:</strong> A reference to this Euler instance.</dt>
  119. </dl>
  120. </div>
  121. <h3 class="name name-method" id="equals" translate="no">.<a href="#equals">equals</a><span class="signature">( euler : <span class="param-type">Euler</span> )</span><span class="type-signature"> : boolean</span> </h3>
  122. <div class="method">
  123. <div class="description">
  124. <p>Returns <code>true</code> if this Euler instance is equal with the given one.</p>
  125. </div>
  126. <table class="params">
  127. <tbody>
  128. <tr>
  129. <td class="name"><code>euler</code></td>
  130. <td class="description last"><p>The Euler instance to test for equality.</p></td>
  131. </tr>
  132. </tbody>
  133. </table>
  134. <dl class="details">
  135. <dt class="tag-returns"><strong>Returns:</strong> Whether this Euler instance is equal with the given one.</dt>
  136. </dl>
  137. </div>
  138. <h3 class="name name-method" id="fromArray" translate="no">.<a href="#fromArray">fromArray</a><span class="signature">( array : <span class="param-type">Array.&lt;number, number, number, ?string></span> )</span><span class="type-signature"> : <a href="Euler.html">Euler</a></span> </h3>
  139. <div class="method">
  140. <div class="description">
  141. <p>Sets this Euler instance's components to values from the given array. The first three
  142. entries of the array are assign to the x,y and z components. An optional fourth entry
  143. defines the Euler order.</p>
  144. </div>
  145. <table class="params">
  146. <tbody>
  147. <tr>
  148. <td class="name"><code>array</code></td>
  149. <td class="description last"><p>An array holding the Euler component values.</p></td>
  150. </tr>
  151. </tbody>
  152. </table>
  153. <dl class="details">
  154. <dt class="tag-returns"><strong>Returns:</strong> A reference to this Euler instance.</dt>
  155. </dl>
  156. </div>
  157. <h3 class="name name-method" id="reorder" translate="no">.<a href="#reorder">reorder</a><span class="signature">( newOrder : <span class="param-type">string</span> )</span><span class="type-signature"> : <a href="Euler.html">Euler</a></span> </h3>
  158. <div class="method">
  159. <div class="description">
  160. <p>Resets the euler angle with a new order by creating a quaternion from this
  161. euler angle and then setting this euler angle with the quaternion and the
  162. new order.</p>
  163. <p>Warning: This discards revolution information.</p>
  164. </div>
  165. <table class="params">
  166. <tbody>
  167. <tr>
  168. <td class="name"><code>newOrder</code></td>
  169. <td class="description last"><p>A string representing the new order that the rotations are applied.</p></td>
  170. </tr>
  171. </tbody>
  172. </table>
  173. <dl class="details">
  174. <dt class="tag-returns"><strong>Returns:</strong> A reference to this Euler instance.</dt>
  175. </dl>
  176. </div>
  177. <h3 class="name name-method" id="set" translate="no">.<a href="#set">set</a><span class="signature">( x : <span class="param-type">number</span>, y : <span class="param-type">number</span>, z : <span class="param-type">number</span>, order : <span class="param-type">string</span> )</span><span class="type-signature"> : <a href="Euler.html">Euler</a></span> </h3>
  178. <div class="method">
  179. <div class="description">
  180. <p>Sets the Euler components.</p>
  181. </div>
  182. <table class="params">
  183. <tbody>
  184. <tr>
  185. <td class="name"><code>x</code></td>
  186. <td class="description last"><p>The angle of the x axis in radians.</p></td>
  187. </tr>
  188. <tr>
  189. <td class="name"><code>y</code></td>
  190. <td class="description last"><p>The angle of the y axis in radians.</p></td>
  191. </tr>
  192. <tr>
  193. <td class="name"><code>z</code></td>
  194. <td class="description last"><p>The angle of the z axis in radians.</p></td>
  195. </tr>
  196. <tr>
  197. <td class="name"><code>order</code></td>
  198. <td class="description last"><p>A string representing the order that the rotations are applied.</p></td>
  199. </tr>
  200. </tbody>
  201. </table>
  202. <dl class="details">
  203. <dt class="tag-returns"><strong>Returns:</strong> A reference to this Euler instance.</dt>
  204. </dl>
  205. </div>
  206. <h3 class="name name-method" id="setFromQuaternion" translate="no">.<a href="#setFromQuaternion">setFromQuaternion</a><span class="signature">( q : <span class="param-type">Quaternion</span>, order : <span class="param-type">string</span>, update : <span class="param-type">boolean</span> )</span><span class="type-signature"> : <a href="Euler.html">Euler</a></span> </h3>
  207. <div class="method">
  208. <div class="description">
  209. <p>Sets the angles of this Euler instance from a normalized quaternion.</p>
  210. </div>
  211. <table class="params">
  212. <tbody>
  213. <tr>
  214. <td class="name"><code>q</code></td>
  215. <td class="description last"><p>A normalized Quaternion.</p></td>
  216. </tr>
  217. <tr>
  218. <td class="name"><code>order</code></td>
  219. <td class="description last"><p>A string representing the order that the rotations are applied.</p></td>
  220. </tr>
  221. <tr>
  222. <td class="name"><code>update</code></td>
  223. <td class="description last"><p>Whether the internal <code>onChange</code> callback should be executed or not.<br/>Default is <code>true</code>.</p></td>
  224. </tr>
  225. </tbody>
  226. </table>
  227. <dl class="details">
  228. <dt class="tag-returns"><strong>Returns:</strong> A reference to this Euler instance.</dt>
  229. </dl>
  230. </div>
  231. <h3 class="name name-method" id="setFromRotationMatrix" translate="no">.<a href="#setFromRotationMatrix">setFromRotationMatrix</a><span class="signature">( m : <span class="param-type">Matrix4</span>, order : <span class="param-type">string</span>, update : <span class="param-type">boolean</span> )</span><span class="type-signature"> : <a href="Euler.html">Euler</a></span> </h3>
  232. <div class="method">
  233. <div class="description">
  234. <p>Sets the angles of this Euler instance from a pure rotation matrix.</p>
  235. </div>
  236. <table class="params">
  237. <tbody>
  238. <tr>
  239. <td class="name"><code>m</code></td>
  240. <td class="description last"><p>A 4x4 matrix of which the upper 3x3 of matrix is a pure rotation matrix (i.e. unscaled).</p></td>
  241. </tr>
  242. <tr>
  243. <td class="name"><code>order</code></td>
  244. <td class="description last"><p>A string representing the order that the rotations are applied.</p></td>
  245. </tr>
  246. <tr>
  247. <td class="name"><code>update</code></td>
  248. <td class="description last"><p>Whether the internal <code>onChange</code> callback should be executed or not.<br/>Default is <code>true</code>.</p></td>
  249. </tr>
  250. </tbody>
  251. </table>
  252. <dl class="details">
  253. <dt class="tag-returns"><strong>Returns:</strong> A reference to this Euler instance.</dt>
  254. </dl>
  255. </div>
  256. <h3 class="name name-method" id="setFromVector3" translate="no">.<a href="#setFromVector3">setFromVector3</a><span class="signature">( v : <span class="param-type">Vector3</span>, order : <span class="param-type">string</span> )</span><span class="type-signature"> : <a href="Euler.html">Euler</a></span> </h3>
  257. <div class="method">
  258. <div class="description">
  259. <p>Sets the angles of this Euler instance from the given vector.</p>
  260. </div>
  261. <table class="params">
  262. <tbody>
  263. <tr>
  264. <td class="name"><code>v</code></td>
  265. <td class="description last"><p>The vector.</p></td>
  266. </tr>
  267. <tr>
  268. <td class="name"><code>order</code></td>
  269. <td class="description last"><p>A string representing the order that the rotations are applied.</p></td>
  270. </tr>
  271. </tbody>
  272. </table>
  273. <dl class="details">
  274. <dt class="tag-returns"><strong>Returns:</strong> A reference to this Euler instance.</dt>
  275. </dl>
  276. </div>
  277. <h3 class="name name-method" id="toArray" translate="no">.<a href="#toArray">toArray</a><span class="signature">( array : <span class="param-type">Array.&lt;number, number, number, string></span>, offset : <span class="param-type">number</span> )</span><span class="type-signature"> : Array.&lt;number, number, number, string></span> </h3>
  278. <div class="method">
  279. <div class="description">
  280. <p>Writes the components of this Euler instance to the given array. If no array is provided,
  281. the method returns a new instance.</p>
  282. </div>
  283. <table class="params">
  284. <tbody>
  285. <tr>
  286. <td class="name"><code>array</code></td>
  287. <td class="description last"><p>The target array holding the Euler components.<br/>Default is <code>[]</code>.</p></td>
  288. </tr>
  289. <tr>
  290. <td class="name"><code>offset</code></td>
  291. <td class="description last"><p>Index of the first element in the array.<br/>Default is <code>0</code>.</p></td>
  292. </tr>
  293. </tbody>
  294. </table>
  295. <dl class="details">
  296. <dt class="tag-returns"><strong>Returns:</strong> The Euler components.</dt>
  297. </dl>
  298. </div>
  299. <h2 class="subsection-title">Source</h2>
  300. <p>
  301. <a href="https://github.com/mrdoob/three.js/blob/master/src/math/Euler.js" target="_blank" rel="noopener" translate="no">src/math/Euler.js</a>
  302. </p>
  303. </article>
  304. </section>
  305. <script src="../scripts/linenumber.js"></script>
  306. <script src="../scripts/page.js"></script>
  307. </body>
  308. </html>
粤ICP备19079148号