Vector2.html 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  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">2D Vector.</div>
  12. <h2>Example</h2>
  13. <code>var a = new THREE.Vector2( 0, 1 );
  14. var b = new THREE.Vector2( 1, 0 );
  15. var d = a.distanceTo( b );
  16. </code>
  17. <h2>Constructor</h2>
  18. <h3>[name]( [page:Float x], [page:Float y] )</h3>
  19. <h2>Properties</h2>
  20. <h3>.[page:Float x]</h3>
  21. <h3>.[page:Float y]</h3>
  22. <h2>Methods</h2>
  23. <h3>.set( [page:Float x], [page:Float y] ) [page:Vector2]</h3>
  24. <div>
  25. Sets value of this vector.
  26. </div>
  27. <h3>.copy( [page:Vector2 v] ) [page:Vector2]</h3>
  28. <div>
  29. Copies value of *v* to this vector.
  30. </div>
  31. <h3>.add( [page:Vector2 a], [page:Vector2 b] ) [page:Vector2]</h3>
  32. <div>
  33. Sets this vector to *a + b*.
  34. </div>
  35. <h3>.addSelf( [page:Vector2 v] ) [page:Vector2]</h3>
  36. <div>
  37. Adds *v* to this vector.
  38. </div>
  39. <h3>.sub( [page:Vector2 a], [page:Vector2 b] ) [page:Vector2]</h3>
  40. <div>
  41. Sets this vector to *a - b*.
  42. </div>
  43. <h3>.subSelf( [page:Vector2 v] ) [page:Vector2]</h3>
  44. <div>
  45. Subtracts *v* from this vector.
  46. </div>
  47. <h3>.multiplyScalar( [page:Float s] ) [page:Vector2]</h3>
  48. <div>
  49. Multiplies this vector by scalar *s*.
  50. </div>
  51. <h3>.divideScalar( [page:Float s] ) [page:Vector2]</h3>
  52. <div>
  53. Divides this vector by scalar *s*.<br />
  54. Set vector to *( 0, 0 )* if *s == 0*.
  55. </div>
  56. <h3>.negate() [page:Vector2]</h3>
  57. <div>
  58. Inverts this vector.
  59. </div>
  60. <h3>.dot( [page:Vector2 v] ) [page:Float]</h3>
  61. <div>
  62. Computes dot product of this vector and *v*.
  63. </div>
  64. <h3>.lengthSq() [page:Float]</h3>
  65. <div>
  66. Computes squared length of this vector.
  67. </div>
  68. <h3>.length() [page:Float]</h3>
  69. <div>
  70. Computes length of this vector.
  71. </div>
  72. <h3>.normalize() [page:Vector2]</h3>
  73. <div>
  74. Normalizes this vector.
  75. </div>
  76. <h3>.distanceTo( [page:Vector2 v] ) [page:Float]</h3>
  77. <div>
  78. Computes distance of this vector to *v*.
  79. </div>
  80. <h3>.distanceToSquared( [page:Vector2 v] ) [page:Float]</h3>
  81. <div>
  82. Computes squared distance of this vector to *v*.
  83. </div>
  84. <h3>.setLength( [page:Float l] ) [page:Vector2]</h3>
  85. <div>
  86. Normalizes this vector and multiplies it by *l*.
  87. </div>
  88. <h3>.equals( [page:Vector2 v] ) [page:Vector2]</h3>
  89. <div>
  90. Checks for strict equality of this vector and *v*.
  91. </div>
  92. <h3>.isZero() [page:Boolean]</h3>
  93. <div>
  94. Checks if length of this vector is within small epsilon (*0.0001*).
  95. </div>
  96. <h3>.clone() [page:Vector2]</h3>
  97. <div>
  98. Clones this vector.
  99. </div>
  100. <h2>Source</h2>
  101. [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
  102. </body>
  103. </html>