Vector3.html 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <script src="../../list.js"></script>
  6. <script src="../../page.js"></script>
  7. <link type="text/css" rel="stylesheet" href="../../page.css" />
  8. </head>
  9. <body>
  10. <h1>[name]</h1>
  11. <div class="desc">3D vector.</div>
  12. <h2>Example</h2>
  13. <code>var a = new THREE.Vector3( 1, 0, 0 );
  14. var b = new THREE.Vector3( 0, 1, 0 );
  15. var c = new THREE.Vector3();
  16. c.cross( a, b );
  17. </code>
  18. <h2>Constructor</h2>
  19. <h3>[name]( [page:Float x], [page:Float y], [page:Float z] )</h3>
  20. <h2>Properties</h2>
  21. <h3>.[page:Float x]</h3>
  22. <h3>.[page:Float y]</h3>
  23. <h3>.[page:Float z]</h3>
  24. <h2>Methods</h2>
  25. <h3>.set( [page:Float x], [page:Float y], [page:Float z] ) [page:Vector3]</h3>
  26. <div>
  27. Sets value of this vector.
  28. </div>
  29. <h3>.setX( [page:Float x] ) [page:Vector3]</h3>
  30. <div>
  31. Sets x value of this vector.
  32. </div>
  33. <h3>.setY( [page:Float y] ) [page:Vector3]</h3>
  34. <div>
  35. Sets y value of this vector.
  36. </div>
  37. <h3>.setZ( [page:Float z] ) [page:Vector3]</h3>
  38. <div>
  39. Sets z value of this vector.
  40. </div>
  41. <h3>.copy( [page:Vector3 v] ) [page:Vector3]</h3>
  42. <div>
  43. Copies value of *v* to this vector.
  44. </div>
  45. <h3>.add( [page:Vector3 a], [page:Vector3 b] ) [page:Vector3]</h3>
  46. <div>
  47. Sets this vector to *a + b*.
  48. </div>
  49. <h3>.addSelf( [page:Vector3 v] ) [page:Vector3]</h3>
  50. <div>
  51. Adds *v* to this vector.
  52. </div>
  53. <h3>.sub( [page:Vector3 a], [page:Vector3 b] ) [page:Vector3]</h3>
  54. <div>
  55. Sets this vector to *a - b*.
  56. </div>
  57. <h3>.subSelf( [page:Vector3 v] ) [page:Vector3]</h3>
  58. <div>
  59. Subtracts *v* from this vector.
  60. </div>
  61. <h3>.multiplyScalar( [page:Float s] ) [page:Vector3]</h3>
  62. <div>
  63. Multiplies this vector by scalar *s*.
  64. </div>
  65. <h3>.divideScalar( [page:Float s] ) [page:Vector3]</h3>
  66. <div>
  67. Divides this vector by scalar *s*.<br />
  68. Set vector to *( 0, 0, 0 )* if *s == 0*.
  69. </div>
  70. <h3>.negate() [page:Vector3]</h3>
  71. <div>
  72. Inverts this vector.
  73. </div>
  74. <h3>.dot( [page:Vector3 v] ) [page:Float]</h3>
  75. <div>
  76. Computes dot product of this vector and *v*.
  77. </div>
  78. <h3>.lengthSq() [page:Float]</h3>
  79. <div>
  80. Computes squared length of this vector.
  81. </div>
  82. <h3>.length() [page:Float]</h3>
  83. <div>
  84. Computes length of this vector.
  85. </div>
  86. <h3>.lengthManhattan() [page:Float]</h3>
  87. <div>
  88. Computes Manhattan length of this vector.<br />
  89. [link:http://en.wikipedia.org/wiki/Taxicab_geometry]
  90. </div>
  91. <h3>.normalize() [page:Vector3]</h3>
  92. <div>
  93. Normalizes this vector.
  94. </div>
  95. <h3>.distanceTo( [page:Vector3 v] ) [page:Float]</h3>
  96. <div>
  97. Computes distance of this vector to *v*.
  98. </div>
  99. <h3>.distanceToSquared( [page:Vector3 v] ) [page:Float]</h3>
  100. <div>
  101. Computes squared distance of this vector to *v*.
  102. </div>
  103. <h3>.normalize() [page:Vector3]</h3>
  104. <div>
  105. Normalizes this vector.
  106. </div>
  107. <h3>.setLength( [page:Float l] ) [page:Vector3]</h3>
  108. <div>
  109. Normalizes this vector and multiplies it by *l*.
  110. </div>
  111. <h3>.cross( [page:Vector3 a], [page:Vector3 b] ) [page:Vector3]</h3>
  112. <div>
  113. Sets this vector to cross product of *a* and *b*.
  114. </div>
  115. <h3>.crossSelf( [page:Vector3 v] ) [page:Vector3]</h3>
  116. <div>
  117. Sets this vector to cross product of itself and *v*.
  118. </div>
  119. <h3>.getPositionFromMatrix( [page:Matrix4 m] ) [page:Vector3]</h3>
  120. <div>
  121. Sets this vector extracting position from matrix transform.
  122. </div>
  123. <h3>.getRotationFromMatrix( [page:Matrix4 m] ) [page:Vector3]</h3>
  124. <div>
  125. Sets this vector extracting Euler angles rotation from matrix transform.
  126. </div>
  127. <h3>.getScaleFromMatrix( [page:Matrix4 m] ) [page:Vector3]</h3>
  128. <div>
  129. Sets this vector extracting scale from matrix transform.
  130. </div>
  131. <h3>.equals( [page:Vector3 v] ) [page:Vector3]</h3>
  132. <div>
  133. Checks for strict equality of this vector and *v*.
  134. </div>
  135. <h3>.isZero() [page:Boolean]</h3>
  136. <div>
  137. Checks if length of this vector is within small epsilon (*0.01*).
  138. </div>
  139. <h3>.clone() [page:Vector3]</h3>
  140. <div>
  141. Clones this vector.
  142. </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>