Triangle.html 5.9 KB

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