Triangle.html 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8" />
  5. <base href="../../" />
  6. <script src="list.js"></script>
  7. <script src="page.js"></script>
  8. <link type="text/css" rel="stylesheet" href="page.css" />
  9. </head>
  10. <body>
  11. <h1>[name]</h1>
  12. <div class="desc">
  13. A geometric triangle as defined by three [page:Vector3 Vector3s] representing its
  14. three corners.
  15. </div>
  16. <h2>Constructor</h2>
  17. <h3>[name]( [page:Vector3 a], [page:Vector3 b], [page:Vector3 c] )</h3>
  18. <div>
  19. [page:Vector3 a] - the first corner of the triangle. Default is a [page:Vector3] at (0, 0, 0).<br />
  20. [page:Vector3 b] - the second corner of the triangle. Default is a [page:Vector3] at (0, 0, 0).<br />
  21. [page:Vector3 c] - the final corner of the triangle. Default is a [page:Vector3] at (0, 0, 0).<br /><br />
  22. Creates a new [name].
  23. </div>
  24. <h2>Properties</h2>
  25. <h3>[property:Vector3 a]</h3>
  26. <div>
  27. The first corner of the triangle. Default is a [page:Vector3] at (0, 0, 0).
  28. </div>
  29. <h3>[property:Vector3 b]</h3>
  30. <div>
  31. The second corner of the triangle. Default is a [page:Vector3] at (0, 0, 0).
  32. </div>
  33. <h3>[property:Vector3 c]</h3>
  34. <div>
  35. the final corner of the triangle. Default is a [page:Vector3] at (0, 0, 0)
  36. </div>
  37. <h2>Methods</h2>
  38. <h3>[method:Float area]()</h3>
  39. <div>Return the area of the triangle.</div>
  40. <h3>[method:Vector3 barycoordFromPoint]( [page:Vector3 point], [page:Vector3 optionalTarget] )</h3>
  41. <div>
  42. [page:Vector3 point] - [page:Vector3] <br />
  43. [page:Vector3 optionalTarget] - (optional) if specified, the result will be copied into this [page:Vector3], otherwise a new [page:Vector3] will be created.<br /><br />
  44. Return a [link:https://en.wikipedia.org/wiki/Barycentric_coordinate_system barycentric coordinate]
  45. from the given vector. <br/><br/>
  46. [link:http://commons.wikimedia.org/wiki/File:Barycentric_coordinates_1.png Picture of barycentric coordinates]
  47. </div>
  48. <h3>[method:Triangle clone]()</h3>
  49. <div>
  50. Returns a new triangle with the same [page:.a a], [page:.b b] and [page:.c c] properties as this one.
  51. </div>
  52. <h3>[method:Vector3 closestPointToPoint]( [page:Vector3 point], [page:Vector3 optionalTarget] )</h3>
  53. <div>
  54. point - [page:Vector3] <br />
  55. [page:Vector3 optionalTarget] - (optional) if specified, the result will be copied into this [page:Vector3], otherwise a new [page:Vector3] will be created.<br /><br />
  56. Returns the closest point on the triangle to [page:Vector3 point].
  57. </div>
  58. <h3>[method:Boolean containsPoint]( [page:Vector3 point] )</h3>
  59. <div>
  60. [page:Vector3 point] - [page:Vector3] to check.<br /><br />
  61. Returns true if the passed vector is within the triangle.
  62. </div>
  63. <h3>[method:Triangle copy]( [page:Triangle triangle] )</h3>
  64. <div>
  65. Copies the values of the passed triangles's [page:.a a], [page:.b b] and [page:.c c]
  66. properties to this triangle.
  67. </div>
  68. <h3>[method:Boolean equals]( [page:Triangle triangle] )</h3>
  69. <div>
  70. Returns true if the two triangles have identical [page:.a a], [page:.b b] and [page:.c c] properties.
  71. </div>
  72. <h3>[method:Vector3 midpoint]( [page:Vector3 optionalTarget] )</h3>
  73. <div>
  74. [page:Vector3 optionalTarget] - (optional) if specified, the result will be copied into this [page:Vector3], otherwise a new [page:Vector3] will be created.<br /><br />
  75. Calculate the midpoint of the triangle.
  76. </div>
  77. <h3>[method:Vector3 normal]( [page:Vector3 optionalTarget] )</h3>
  78. <div>
  79. [page:Vector3 optionalTarget] - (optional) if specified, the result will be copied into this [page:Vector3], otherwise a new [page:Vector3] will be created.<br /><br />
  80. Calculate the [link:https://en.wikipedia.org/wiki/Normal_(geometry) normal vector] of the triangle.
  81. </div>
  82. <h3>[method:Plane plane]( [page:Plane optionalTarget] )</h3>
  83. <div>
  84. [page:Plane optionalTarget] - (optional) if specified, the result will be copied into this [page:Plane], otherwise a new [page:Plane] will be created.<br /><br />
  85. Create a [page:Plane plane] based on the triangle. .
  86. </div>
  87. <h3>[method:Triangle set]( [page:Vector3 a], [page:Vector3 b], [page:Vector3 c] ) [page:Triangle this]</h3>
  88. <div>
  89. Sets the triangle's [page:.a a], [page:.b b] and [page:.c c] properties to the passed [page:vector3 vector3s].
  90. </div>
  91. <h3>[method:Triangle setFromPointsAndIndices]( [page:Array points], [page:Integer i0], [page:Integer i1], [page:Integer i2] ) [page:Triangle this]</h3>
  92. <div>
  93. points - [page:Array] of [page:Vector3]s <br />
  94. i0 - [page:Integer] index <br />
  95. i1 - [page:Integer] index <br />
  96. i2 - [page:Integer] index<br /><br />
  97. Sets the triangle's vectors to the vectors in the array.
  98. </div>
  99. <h2>Source</h2>
  100. [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
  101. </body>
  102. </html>