Triangle.html 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8" />
  5. <base href="../../../" />
  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. <p class="desc">
  12. A geometric triangle as defined by three [page:Vector3 Vector3s]
  13. representing its three corners.
  14. </p>
  15. <h2>Constructor</h2>
  16. <h3>[name]( [param:Vector3 a], [param:Vector3 b], [param:Vector3 c] )</h3>
  17. <p>
  18. [page:Vector3 a] - the first corner of the triangle. Default is a
  19. [page:Vector3] at `(0, 0, 0)`.<br />
  20. [page:Vector3 b] - the second corner of the triangle. Default is a
  21. [page:Vector3] at `(0, 0, 0)`.<br />
  22. [page:Vector3 c] - the final corner of the triangle. Default is a
  23. [page:Vector3] at `(0, 0, 0)`.<br /><br />
  24. Creates a new [name].
  25. </p>
  26. <h2>Properties</h2>
  27. <h3>[property:Vector3 a]</h3>
  28. <p>
  29. The first corner of the triangle. Default is a [page:Vector3] at `(0, 0,
  30. 0)`.
  31. </p>
  32. <h3>[property:Vector3 b]</h3>
  33. <p>
  34. The second corner of the triangle. Default is a [page:Vector3] at `(0, 0,
  35. 0)`.
  36. </p>
  37. <h3>[property:Vector3 c]</h3>
  38. <p>
  39. The final corner of the triangle. Default is a [page:Vector3] at `(0, 0,
  40. 0)`.
  41. </p>
  42. <h2>Methods</h2>
  43. <h3>[method:Triangle clone]()</h3>
  44. <p>
  45. Returns a new triangle with the same [page:.a a], [page:.b b] and [page:.c c]
  46. properties as this one.
  47. </p>
  48. <h3>
  49. [method:Vector3 closestPointToPoint]( [param:Vector3 point],
  50. [param:Vector3 target] )
  51. </h3>
  52. <p>
  53. [page:Vector3 point] - [page:Vector3] <br />
  54. [page:Vector3 target] — the result will be copied into this Vector3.<br /><br />
  55. Returns the closest point on the triangle to [page:Vector3 point].
  56. </p>
  57. <h3>[method:Boolean containsPoint]( [param:Vector3 point] )</h3>
  58. <p>
  59. [page:Vector3 point] - [page:Vector3] to check.<br /><br />
  60. Returns true if the passed point, when projected onto the plane of the
  61. triangle, lies within the triangle.
  62. </p>
  63. <h3>[method:this copy]( [param:Triangle triangle] )</h3>
  64. <p>
  65. Copies the values of the passed triangles's [page:.a a], [page:.b b] and
  66. [page:.c c] properties to this triangle.
  67. </p>
  68. <h3>[method:Boolean equals]( [param:Triangle triangle] )</h3>
  69. <p>
  70. Returns true if the two triangles have identical [page:.a a], [page:.b b]
  71. and [page:.c c] properties.
  72. </p>
  73. <h3>[method:Float getArea]()</h3>
  74. <p>Return the area of the triangle.</p>
  75. <h3>
  76. [method:Vector3 getBarycoord]( [param:Vector3 point], [param:Vector3 target] )
  77. </h3>
  78. <p>
  79. [page:Vector3 point] - [page:Vector3] <br />
  80. [page:Vector3 target] — the result will be copied into this Vector3.<br /><br />
  81. Return a [link:https://en.wikipedia.org/wiki/Barycentric_coordinate_system barycentric coordinate]
  82. from the given vector. <br /><br />
  83. [link:http://commons.wikimedia.org/wiki/File:Barycentric_coordinates_1.png Picture of barycentric coordinates]
  84. </p>
  85. <h3>[method:Vector3 getMidpoint]( [param:Vector3 target] )</h3>
  86. <p>
  87. [page:Vector3 target] — the result will be copied into this Vector3.<br /><br />
  88. Calculate the midpoint of the triangle.
  89. </p>
  90. <h3>[method:Vector3 getNormal]( [param:Vector3 target] )</h3>
  91. <p>
  92. [page:Vector3 target] — the result will be copied into this Vector3.<br /><br />
  93. Calculate the [link:https://en.wikipedia.org/wiki/Normal_(geometry) normal vector] of the triangle.
  94. </p>
  95. <h3>[method:Plane getPlane]( [param:Plane target] )</h3>
  96. <p>
  97. [page:Plane target] — the result will be copied into this Plane.<br /><br />
  98. Calculate a [page:Plane plane] based on the triangle. .
  99. </p>
  100. <h3>
  101. [method:Vector getInterpolation]( [param:Vector3 point], [param:Vector3 p1],
  102. [param:Vector3 p2], [param:Vector3 p3], [param:Vector v1],
  103. [param:Vector v2], [param:Vector v3], [param:Vector target] )
  104. </h3>
  105. <p>
  106. [page:Vector3 point] - Position of interpolated point.<br />
  107. [page:Vector3 p1] - Position of first vertex.<br />
  108. [page:Vector3 p2] - Position of second vertex.<br />
  109. [page:Vector3 p3] - Position of third vertex.<br />
  110. [page:Vector v1] - Value of first vertex.<br />
  111. [page:Vector v2] - Value of second vertex.<br />
  112. [page:Vector v3] - Value of third vertex.<br />
  113. [page:Vector target] — Result will be copied into this Vector.<br /><br />
  114. Returns the value barycentrically interpolated for the given point on the
  115. triangle.
  116. </p>
  117. <h3>[method:Boolean intersectsBox]( [param:Box3 box] )</h3>
  118. <p>
  119. [page:Box3 box] - Box to check for intersection against.<br /><br />
  120. Determines whether or not this triangle intersects [page:Box3 box].
  121. </p>
  122. <h3>[method:Boolean isFrontFacing]( [param:Vector3 direction] )</h3>
  123. <p>
  124. [page:Vector3 direction] - The direction to test.<br /><br />
  125. Whether the triangle is oriented towards the given direction or not.
  126. </p>
  127. <h3>
  128. [method:this set]( [param:Vector3 a], [param:Vector3 b], [param:Vector3 c] )
  129. [param:Triangle this]
  130. </h3>
  131. <p>
  132. Sets the triangle's [page:.a a], [page:.b b] and [page:.c c] properties to
  133. the passed [page:Vector3 vector3s].<br />
  134. Please note that this method only copies the values from the given
  135. objects.
  136. </p>
  137. <h3>
  138. [method:this setFromAttributeAndIndices]( [param:BufferAttribute attribute],
  139. [param:Integer i0], [param:Integer i1], [param:Integer i2] )
  140. [param:Triangle this]
  141. </h3>
  142. <p>
  143. attribute - [page:BufferAttribute] of vertex data <br />
  144. i0 - [page:Integer] index <br />
  145. i1 - [page:Integer] index <br />
  146. i2 - [page:Integer] index<br /><br />
  147. Sets the triangle's vertices from the buffer attribute vertex data.
  148. </p>
  149. <h3>
  150. [method:this setFromPointsAndIndices]( [param:Array points],
  151. [param:Integer i0], [param:Integer i1], [param:Integer i2] )
  152. [param:Triangle this]
  153. </h3>
  154. <p>
  155. points - [page:Array] of [page:Vector3]s <br />
  156. i0 - [page:Integer] index <br />
  157. i1 - [page:Integer] index <br />
  158. i2 - [page:Integer] index<br /><br />
  159. Sets the triangle's vectors to the vectors in the array.
  160. </p>
  161. <h2>Source</h2>
  162. <p>
  163. [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
  164. </p>
  165. </body>
  166. </html>