Triangle.html 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>Triangle - Three.js Docs</title>
  6. <meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
  7. <script src="../scripts/highlight.min.js"></script>
  8. <link type="text/css" rel="stylesheet" href="../styles/highlight-three.css">
  9. <link type="text/css" rel="stylesheet" href="../styles/page.css">
  10. </head>
  11. <body>
  12. <h1 translate="no">Triangle</h1>
  13. <section>
  14. <header>
  15. <div class="class-description"><p>A geometric triangle as defined by three vectors representing its three corners.</p></div>
  16. </header>
  17. <article>
  18. <div class="container-overview">
  19. <h2>Constructor</h2>
  20. <h3 class="name name-method" id="Triangle" translate="no">new <a href="#Triangle">Triangle</a><span class="signature">( a : <span class="param-type">Vector3</span>, b : <span class="param-type">Vector3</span>, c : <span class="param-type">Vector3</span> )</span> </h3>
  21. <div class="method">
  22. <div class="description">
  23. <p>Constructs a new triangle.</p>
  24. </div>
  25. <table class="params">
  26. <tbody>
  27. <tr>
  28. <td class="name"><code>a</code></td>
  29. <td class="description last"><p>The first corner of the triangle.<br/>Default is <code>(0,0,0)</code>.</p></td>
  30. </tr>
  31. <tr>
  32. <td class="name"><code>b</code></td>
  33. <td class="description last"><p>The second corner of the triangle.<br/>Default is <code>(0,0,0)</code>.</p></td>
  34. </tr>
  35. <tr>
  36. <td class="name"><code>c</code></td>
  37. <td class="description last"><p>The third corner of the triangle.<br/>Default is <code>(0,0,0)</code>.</p></td>
  38. </tr>
  39. </tbody>
  40. </table>
  41. </div>
  42. </div>
  43. <h2 class="subsection-title">Properties</h2>
  44. <div class="member">
  45. <h3 class="name" id="a" translate="no">.<a href="#a">a</a><span class="type-signature"> : <a href="Vector3.html">Vector3</a></span> </h3>
  46. <div class="description">
  47. <p>The first corner of the triangle.</p>
  48. </div>
  49. </div>
  50. <div class="member">
  51. <h3 class="name" id="b" translate="no">.<a href="#b">b</a><span class="type-signature"> : <a href="Vector3.html">Vector3</a></span> </h3>
  52. <div class="description">
  53. <p>The second corner of the triangle.</p>
  54. </div>
  55. </div>
  56. <div class="member">
  57. <h3 class="name" id="c" translate="no">.<a href="#c">c</a><span class="type-signature"> : <a href="Vector3.html">Vector3</a></span> </h3>
  58. <div class="description">
  59. <p>The third corner of the triangle.</p>
  60. </div>
  61. </div>
  62. <h2 class="subsection-title">Methods</h2>
  63. <h3 class="name name-method" id="clone" translate="no">.<a href="#clone">clone</a><span class="signature">()</span><span class="type-signature"> : <a href="Triangle.html">Triangle</a></span> </h3>
  64. <div class="method">
  65. <div class="description">
  66. <p>Returns a new triangle with copied values from this instance.</p>
  67. </div>
  68. <dl class="details">
  69. <dt class="tag-returns"><strong>Returns:</strong> A clone of this instance.</dt>
  70. </dl>
  71. </div>
  72. <h3 class="name name-method" id="closestPointToPoint" translate="no">.<a href="#closestPointToPoint">closestPointToPoint</a><span class="signature">( p : <span class="param-type">Vector3</span>, target : <span class="param-type">Vector3</span> )</span><span class="type-signature"> : <a href="Vector3.html">Vector3</a></span> </h3>
  73. <div class="method">
  74. <div class="description">
  75. <p>Returns the closest point on the triangle to the given point.</p>
  76. </div>
  77. <table class="params">
  78. <tbody>
  79. <tr>
  80. <td class="name"><code>p</code></td>
  81. <td class="description last"><p>The point to compute the closest point for.</p></td>
  82. </tr>
  83. <tr>
  84. <td class="name"><code>target</code></td>
  85. <td class="description last"><p>The target vector that is used to store the method's result.</p></td>
  86. </tr>
  87. </tbody>
  88. </table>
  89. <dl class="details">
  90. <dt class="tag-returns"><strong>Returns:</strong> The closest point on the triangle.</dt>
  91. </dl>
  92. </div>
  93. <h3 class="name name-method" id="containsPoint" translate="no">.<a href="#containsPoint">containsPoint</a><span class="signature">( point : <span class="param-type">Vector3</span> )</span><span class="type-signature"> : boolean</span> </h3>
  94. <div class="method">
  95. <div class="description">
  96. <p>Returns <code>true</code> if the given point, when projected onto the plane of the
  97. triangle, lies within the triangle.</p>
  98. </div>
  99. <table class="params">
  100. <tbody>
  101. <tr>
  102. <td class="name"><code>point</code></td>
  103. <td class="description last"><p>The point in 3D space to test.</p></td>
  104. </tr>
  105. </tbody>
  106. </table>
  107. <dl class="details">
  108. <dt class="tag-returns"><strong>Returns:</strong> Whether the given point, when projected onto the plane of the
  109. triangle, lies within the triangle or not.</dt>
  110. </dl>
  111. </div>
  112. <h3 class="name name-method" id="copy" translate="no">.<a href="#copy">copy</a><span class="signature">( triangle : <span class="param-type">Triangle</span> )</span><span class="type-signature"> : <a href="Triangle.html">Triangle</a></span> </h3>
  113. <div class="method">
  114. <div class="description">
  115. <p>Copies the values of the given triangle to this instance.</p>
  116. </div>
  117. <table class="params">
  118. <tbody>
  119. <tr>
  120. <td class="name"><code>triangle</code></td>
  121. <td class="description last"><p>The triangle to copy.</p></td>
  122. </tr>
  123. </tbody>
  124. </table>
  125. <dl class="details">
  126. <dt class="tag-returns"><strong>Returns:</strong> A reference to this triangle.</dt>
  127. </dl>
  128. </div>
  129. <h3 class="name name-method" id="equals" translate="no">.<a href="#equals">equals</a><span class="signature">( triangle : <span class="param-type">Triangle</span> )</span><span class="type-signature"> : boolean</span> </h3>
  130. <div class="method">
  131. <div class="description">
  132. <p>Returns <code>true</code> if this triangle is equal with the given one.</p>
  133. </div>
  134. <table class="params">
  135. <tbody>
  136. <tr>
  137. <td class="name"><code>triangle</code></td>
  138. <td class="description last"><p>The triangle to test for equality.</p></td>
  139. </tr>
  140. </tbody>
  141. </table>
  142. <dl class="details">
  143. <dt class="tag-returns"><strong>Returns:</strong> Whether this triangle is equal with the given one.</dt>
  144. </dl>
  145. </div>
  146. <h3 class="name name-method" id="getArea" translate="no">.<a href="#getArea">getArea</a><span class="signature">()</span><span class="type-signature"> : number</span> </h3>
  147. <div class="method">
  148. <div class="description">
  149. <p>Computes the area of the triangle.</p>
  150. </div>
  151. <dl class="details">
  152. <dt class="tag-returns"><strong>Returns:</strong> The triangle's area.</dt>
  153. </dl>
  154. </div>
  155. <h3 class="name name-method" id="getBarycoord" translate="no">.<a href="#getBarycoord">getBarycoord</a><span class="signature">( point : <span class="param-type">Vector3</span>, target : <span class="param-type">Vector3</span> )</span><span class="type-signature"> : <a href="Vector3.html">Vector3</a></span> </h3>
  156. <div class="method">
  157. <div class="description">
  158. <p>Computes a barycentric coordinates from the given vector.
  159. Returns <code>null</code> if the triangle is degenerate.</p>
  160. </div>
  161. <table class="params">
  162. <tbody>
  163. <tr>
  164. <td class="name"><code>point</code></td>
  165. <td class="description last"><p>A point in 3D space.</p></td>
  166. </tr>
  167. <tr>
  168. <td class="name"><code>target</code></td>
  169. <td class="description last"><p>The target vector that is used to store the method's result.</p></td>
  170. </tr>
  171. </tbody>
  172. </table>
  173. <dl class="details">
  174. <dt class="tag-returns"><strong>Returns:</strong> The barycentric coordinates for the given point</dt>
  175. </dl>
  176. </div>
  177. <h3 class="name name-method" id="getInterpolation" translate="no">.<a href="#getInterpolation">getInterpolation</a><span class="signature">( point : <span class="param-type">Vector3</span>, v1 : <span class="param-type">Vector3</span>, v2 : <span class="param-type">Vector3</span>, v3 : <span class="param-type">Vector3</span>, target : <span class="param-type">Vector3</span> )</span><span class="type-signature"> : <a href="Vector3.html">Vector3</a></span> </h3>
  178. <div class="method">
  179. <div class="description">
  180. <p>Computes the value barycentrically interpolated for the given point on the
  181. triangle. Returns <code>null</code> if the triangle is degenerate.</p>
  182. </div>
  183. <table class="params">
  184. <tbody>
  185. <tr>
  186. <td class="name"><code>point</code></td>
  187. <td class="description last"><p>Position of interpolated point.</p></td>
  188. </tr>
  189. <tr>
  190. <td class="name"><code>v1</code></td>
  191. <td class="description last"><p>Value to interpolate of first vertex.</p></td>
  192. </tr>
  193. <tr>
  194. <td class="name"><code>v2</code></td>
  195. <td class="description last"><p>Value to interpolate of second vertex.</p></td>
  196. </tr>
  197. <tr>
  198. <td class="name"><code>v3</code></td>
  199. <td class="description last"><p>Value to interpolate of third vertex.</p></td>
  200. </tr>
  201. <tr>
  202. <td class="name"><code>target</code></td>
  203. <td class="description last"><p>The target vector that is used to store the method's result.</p></td>
  204. </tr>
  205. </tbody>
  206. </table>
  207. <dl class="details">
  208. <dt class="tag-returns"><strong>Returns:</strong> The interpolated value.</dt>
  209. </dl>
  210. </div>
  211. <h3 class="name name-method" id="getMidpoint" translate="no">.<a href="#getMidpoint">getMidpoint</a><span class="signature">( target : <span class="param-type">Vector3</span> )</span><span class="type-signature"> : <a href="Vector3.html">Vector3</a></span> </h3>
  212. <div class="method">
  213. <div class="description">
  214. <p>Computes the midpoint of the triangle.</p>
  215. </div>
  216. <table class="params">
  217. <tbody>
  218. <tr>
  219. <td class="name"><code>target</code></td>
  220. <td class="description last"><p>The target vector that is used to store the method's result.</p></td>
  221. </tr>
  222. </tbody>
  223. </table>
  224. <dl class="details">
  225. <dt class="tag-returns"><strong>Returns:</strong> The triangle's midpoint.</dt>
  226. </dl>
  227. </div>
  228. <h3 class="name name-method" id="getNormal" translate="no">.<a href="#getNormal">getNormal</a><span class="signature">( target : <span class="param-type">Vector3</span> )</span><span class="type-signature"> : <a href="Vector3.html">Vector3</a></span> </h3>
  229. <div class="method">
  230. <div class="description">
  231. <p>Computes the normal of the triangle.</p>
  232. </div>
  233. <table class="params">
  234. <tbody>
  235. <tr>
  236. <td class="name"><code>target</code></td>
  237. <td class="description last"><p>The target vector that is used to store the method's result.</p></td>
  238. </tr>
  239. </tbody>
  240. </table>
  241. <dl class="details">
  242. <dt class="tag-returns"><strong>Returns:</strong> The triangle's normal.</dt>
  243. </dl>
  244. </div>
  245. <h3 class="name name-method" id="getPlane" translate="no">.<a href="#getPlane">getPlane</a><span class="signature">( target : <span class="param-type">Plane</span> )</span><span class="type-signature"> : <a href="Plane.html">Plane</a></span> </h3>
  246. <div class="method">
  247. <div class="description">
  248. <p>Computes a plane the triangle lies within.</p>
  249. </div>
  250. <table class="params">
  251. <tbody>
  252. <tr>
  253. <td class="name"><code>target</code></td>
  254. <td class="description last"><p>The target vector that is used to store the method's result.</p></td>
  255. </tr>
  256. </tbody>
  257. </table>
  258. <dl class="details">
  259. <dt class="tag-returns"><strong>Returns:</strong> The plane the triangle lies within.</dt>
  260. </dl>
  261. </div>
  262. <h3 class="name name-method" id="intersectsBox" translate="no">.<a href="#intersectsBox">intersectsBox</a><span class="signature">( box : <span class="param-type">Box3</span> )</span><span class="type-signature"> : boolean</span> </h3>
  263. <div class="method">
  264. <div class="description">
  265. <p>Returns <code>true</code> if this triangle intersects with the given box.</p>
  266. </div>
  267. <table class="params">
  268. <tbody>
  269. <tr>
  270. <td class="name"><code>box</code></td>
  271. <td class="description last"><p>The box to intersect.</p></td>
  272. </tr>
  273. </tbody>
  274. </table>
  275. <dl class="details">
  276. <dt class="tag-returns"><strong>Returns:</strong> Whether this triangle intersects with the given box or not.</dt>
  277. </dl>
  278. </div>
  279. <h3 class="name name-method" id="isFrontFacing" translate="no">.<a href="#isFrontFacing">isFrontFacing</a><span class="signature">( direction : <span class="param-type">Vector3</span> )</span><span class="type-signature"> : boolean</span> </h3>
  280. <div class="method">
  281. <div class="description">
  282. <p>Returns <code>true</code> if the triangle is oriented towards the given direction.</p>
  283. </div>
  284. <table class="params">
  285. <tbody>
  286. <tr>
  287. <td class="name"><code>direction</code></td>
  288. <td class="description last"><p>The (normalized) direction vector.</p></td>
  289. </tr>
  290. </tbody>
  291. </table>
  292. <dl class="details">
  293. <dt class="tag-returns"><strong>Returns:</strong> Whether the triangle is oriented towards the given direction or not.</dt>
  294. </dl>
  295. </div>
  296. <h3 class="name name-method" id="set" translate="no">.<a href="#set">set</a><span class="signature">( a : <span class="param-type">Vector3</span>, b : <span class="param-type">Vector3</span>, c : <span class="param-type">Vector3</span> )</span><span class="type-signature"> : <a href="Triangle.html">Triangle</a></span> </h3>
  297. <div class="method">
  298. <div class="description">
  299. <p>Sets the triangle's vertices by copying the given values.</p>
  300. </div>
  301. <table class="params">
  302. <tbody>
  303. <tr>
  304. <td class="name"><code>a</code></td>
  305. <td class="description last"><p>The first corner of the triangle.</p></td>
  306. </tr>
  307. <tr>
  308. <td class="name"><code>b</code></td>
  309. <td class="description last"><p>The second corner of the triangle.</p></td>
  310. </tr>
  311. <tr>
  312. <td class="name"><code>c</code></td>
  313. <td class="description last"><p>The third corner of the triangle.</p></td>
  314. </tr>
  315. </tbody>
  316. </table>
  317. <dl class="details">
  318. <dt class="tag-returns"><strong>Returns:</strong> A reference to this triangle.</dt>
  319. </dl>
  320. </div>
  321. <h3 class="name name-method" id="setFromAttributeAndIndices" translate="no">.<a href="#setFromAttributeAndIndices">setFromAttributeAndIndices</a><span class="signature">( attribute : <span class="param-type">BufferAttribute</span>, i0 : <span class="param-type">number</span>, i1 : <span class="param-type">number</span>, i2 : <span class="param-type">number</span> )</span><span class="type-signature"> : <a href="Triangle.html">Triangle</a></span> </h3>
  322. <div class="method">
  323. <div class="description">
  324. <p>Sets the triangle's vertices by copying the given attribute values.</p>
  325. </div>
  326. <table class="params">
  327. <tbody>
  328. <tr>
  329. <td class="name"><code>attribute</code></td>
  330. <td class="description last"><p>A buffer attribute with 3D points data.</p></td>
  331. </tr>
  332. <tr>
  333. <td class="name"><code>i0</code></td>
  334. <td class="description last"><p>The attribute index representing the first corner of the triangle.</p></td>
  335. </tr>
  336. <tr>
  337. <td class="name"><code>i1</code></td>
  338. <td class="description last"><p>The attribute index representing the second corner of the triangle.</p></td>
  339. </tr>
  340. <tr>
  341. <td class="name"><code>i2</code></td>
  342. <td class="description last"><p>The attribute index representing the third corner of the triangle.</p></td>
  343. </tr>
  344. </tbody>
  345. </table>
  346. <dl class="details">
  347. <dt class="tag-returns"><strong>Returns:</strong> A reference to this triangle.</dt>
  348. </dl>
  349. </div>
  350. <h3 class="name name-method" id="setFromPointsAndIndices" translate="no">.<a href="#setFromPointsAndIndices">setFromPointsAndIndices</a><span class="signature">( points : <span class="param-type">Array.&lt;Vector3></span>, i0 : <span class="param-type">number</span>, i1 : <span class="param-type">number</span>, i2 : <span class="param-type">number</span> )</span><span class="type-signature"> : <a href="Triangle.html">Triangle</a></span> </h3>
  351. <div class="method">
  352. <div class="description">
  353. <p>Sets the triangle's vertices by copying the given array values.</p>
  354. </div>
  355. <table class="params">
  356. <tbody>
  357. <tr>
  358. <td class="name"><code>points</code></td>
  359. <td class="description last"><p>An array with 3D points.</p></td>
  360. </tr>
  361. <tr>
  362. <td class="name"><code>i0</code></td>
  363. <td class="description last"><p>The array index representing the first corner of the triangle.</p></td>
  364. </tr>
  365. <tr>
  366. <td class="name"><code>i1</code></td>
  367. <td class="description last"><p>The array index representing the second corner of the triangle.</p></td>
  368. </tr>
  369. <tr>
  370. <td class="name"><code>i2</code></td>
  371. <td class="description last"><p>The array index representing the third corner of the triangle.</p></td>
  372. </tr>
  373. </tbody>
  374. </table>
  375. <dl class="details">
  376. <dt class="tag-returns"><strong>Returns:</strong> A reference to this triangle.</dt>
  377. </dl>
  378. </div>
  379. <h2 class="subsection-title">Static Methods</h2>
  380. <h3 class="name name-method" id=".containsPoint" translate="no">.<a href="#.containsPoint">containsPoint</a><span class="signature">( point : <span class="param-type">Vector3</span>, a : <span class="param-type">Vector3</span>, b : <span class="param-type">Vector3</span>, c : <span class="param-type">Vector3</span> )</span><span class="type-signature"> : boolean</span> </h3>
  381. <div class="method">
  382. <div class="description">
  383. <p>Returns <code>true</code> if the given point, when projected onto the plane of the
  384. triangle, lies within the triangle.</p>
  385. </div>
  386. <table class="params">
  387. <tbody>
  388. <tr>
  389. <td class="name"><code>point</code></td>
  390. <td class="description last"><p>The point in 3D space to test.</p></td>
  391. </tr>
  392. <tr>
  393. <td class="name"><code>a</code></td>
  394. <td class="description last"><p>The first corner of the triangle.</p></td>
  395. </tr>
  396. <tr>
  397. <td class="name"><code>b</code></td>
  398. <td class="description last"><p>The second corner of the triangle.</p></td>
  399. </tr>
  400. <tr>
  401. <td class="name"><code>c</code></td>
  402. <td class="description last"><p>The third corner of the triangle.</p></td>
  403. </tr>
  404. </tbody>
  405. </table>
  406. <dl class="details">
  407. <dt class="tag-returns"><strong>Returns:</strong> Whether the given point, when projected onto the plane of the
  408. triangle, lies within the triangle or not.</dt>
  409. </dl>
  410. </div>
  411. <h3 class="name name-method" id=".getBarycoord" translate="no">.<a href="#.getBarycoord">getBarycoord</a><span class="signature">( point : <span class="param-type">Vector3</span>, a : <span class="param-type">Vector3</span>, b : <span class="param-type">Vector3</span>, c : <span class="param-type">Vector3</span>, target : <span class="param-type">Vector3</span> )</span><span class="type-signature"> : <a href="Vector3.html">Vector3</a></span> </h3>
  412. <div class="method">
  413. <div class="description">
  414. <p>Computes a barycentric coordinates from the given vector.
  415. Returns <code>null</code> if the triangle is degenerate.</p>
  416. </div>
  417. <table class="params">
  418. <tbody>
  419. <tr>
  420. <td class="name"><code>point</code></td>
  421. <td class="description last"><p>A point in 3D space.</p></td>
  422. </tr>
  423. <tr>
  424. <td class="name"><code>a</code></td>
  425. <td class="description last"><p>The first corner of the triangle.</p></td>
  426. </tr>
  427. <tr>
  428. <td class="name"><code>b</code></td>
  429. <td class="description last"><p>The second corner of the triangle.</p></td>
  430. </tr>
  431. <tr>
  432. <td class="name"><code>c</code></td>
  433. <td class="description last"><p>The third corner of the triangle.</p></td>
  434. </tr>
  435. <tr>
  436. <td class="name"><code>target</code></td>
  437. <td class="description last"><p>The target vector that is used to store the method's result.</p></td>
  438. </tr>
  439. </tbody>
  440. </table>
  441. <dl class="details">
  442. <dt class="tag-returns"><strong>Returns:</strong> The barycentric coordinates for the given point</dt>
  443. </dl>
  444. </div>
  445. <h3 class="name name-method" id=".getInterpolatedAttribute" translate="no">.<a href="#.getInterpolatedAttribute">getInterpolatedAttribute</a><span class="signature">( attr : <span class="param-type">BufferAttribute</span>, i1 : <span class="param-type">number</span>, i2 : <span class="param-type">number</span>, i3 : <span class="param-type">number</span>, barycoord : <span class="param-type">Vector3</span>, target : <span class="param-type">Vector3</span> )</span><span class="type-signature"> : <a href="Vector3.html">Vector3</a></span> </h3>
  446. <div class="method">
  447. <div class="description">
  448. <p>Computes the value barycentrically interpolated for the given attribute and indices.</p>
  449. </div>
  450. <table class="params">
  451. <tbody>
  452. <tr>
  453. <td class="name"><code>attr</code></td>
  454. <td class="description last"><p>The attribute to interpolate.</p></td>
  455. </tr>
  456. <tr>
  457. <td class="name"><code>i1</code></td>
  458. <td class="description last"><p>Index of first vertex.</p></td>
  459. </tr>
  460. <tr>
  461. <td class="name"><code>i2</code></td>
  462. <td class="description last"><p>Index of second vertex.</p></td>
  463. </tr>
  464. <tr>
  465. <td class="name"><code>i3</code></td>
  466. <td class="description last"><p>Index of third vertex.</p></td>
  467. </tr>
  468. <tr>
  469. <td class="name"><code>barycoord</code></td>
  470. <td class="description last"><p>The barycoordinate value to use to interpolate.</p></td>
  471. </tr>
  472. <tr>
  473. <td class="name"><code>target</code></td>
  474. <td class="description last"><p>The target vector that is used to store the method's result.</p></td>
  475. </tr>
  476. </tbody>
  477. </table>
  478. <dl class="details">
  479. <dt class="tag-returns"><strong>Returns:</strong> The interpolated attribute value.</dt>
  480. </dl>
  481. </div>
  482. <h3 class="name name-method" id=".getInterpolation" translate="no">.<a href="#.getInterpolation">getInterpolation</a><span class="signature">( point : <span class="param-type">Vector3</span>, p1 : <span class="param-type">Vector3</span>, p2 : <span class="param-type">Vector3</span>, p3 : <span class="param-type">Vector3</span>, v1 : <span class="param-type">Vector3</span>, v2 : <span class="param-type">Vector3</span>, v3 : <span class="param-type">Vector3</span>, target : <span class="param-type">Vector3</span> )</span><span class="type-signature"> : <a href="Vector3.html">Vector3</a></span> </h3>
  483. <div class="method">
  484. <div class="description">
  485. <p>Computes the value barycentrically interpolated for the given point on the
  486. triangle. Returns <code>null</code> if the triangle is degenerate.</p>
  487. </div>
  488. <table class="params">
  489. <tbody>
  490. <tr>
  491. <td class="name"><code>point</code></td>
  492. <td class="description last"><p>Position of interpolated point.</p></td>
  493. </tr>
  494. <tr>
  495. <td class="name"><code>p1</code></td>
  496. <td class="description last"><p>The first corner of the triangle.</p></td>
  497. </tr>
  498. <tr>
  499. <td class="name"><code>p2</code></td>
  500. <td class="description last"><p>The second corner of the triangle.</p></td>
  501. </tr>
  502. <tr>
  503. <td class="name"><code>p3</code></td>
  504. <td class="description last"><p>The third corner of the triangle.</p></td>
  505. </tr>
  506. <tr>
  507. <td class="name"><code>v1</code></td>
  508. <td class="description last"><p>Value to interpolate of first vertex.</p></td>
  509. </tr>
  510. <tr>
  511. <td class="name"><code>v2</code></td>
  512. <td class="description last"><p>Value to interpolate of second vertex.</p></td>
  513. </tr>
  514. <tr>
  515. <td class="name"><code>v3</code></td>
  516. <td class="description last"><p>Value to interpolate of third vertex.</p></td>
  517. </tr>
  518. <tr>
  519. <td class="name"><code>target</code></td>
  520. <td class="description last"><p>The target vector that is used to store the method's result.</p></td>
  521. </tr>
  522. </tbody>
  523. </table>
  524. <dl class="details">
  525. <dt class="tag-returns"><strong>Returns:</strong> The interpolated value.</dt>
  526. </dl>
  527. </div>
  528. <h3 class="name name-method" id=".getNormal" translate="no">.<a href="#.getNormal">getNormal</a><span class="signature">( a : <span class="param-type">Vector3</span>, b : <span class="param-type">Vector3</span>, c : <span class="param-type">Vector3</span>, target : <span class="param-type">Vector3</span> )</span><span class="type-signature"> : <a href="Vector3.html">Vector3</a></span> </h3>
  529. <div class="method">
  530. <div class="description">
  531. <p>Computes the normal vector of a triangle.</p>
  532. </div>
  533. <table class="params">
  534. <tbody>
  535. <tr>
  536. <td class="name"><code>a</code></td>
  537. <td class="description last"><p>The first corner of the triangle.</p></td>
  538. </tr>
  539. <tr>
  540. <td class="name"><code>b</code></td>
  541. <td class="description last"><p>The second corner of the triangle.</p></td>
  542. </tr>
  543. <tr>
  544. <td class="name"><code>c</code></td>
  545. <td class="description last"><p>The third corner of the triangle.</p></td>
  546. </tr>
  547. <tr>
  548. <td class="name"><code>target</code></td>
  549. <td class="description last"><p>The target vector that is used to store the method's result.</p></td>
  550. </tr>
  551. </tbody>
  552. </table>
  553. <dl class="details">
  554. <dt class="tag-returns"><strong>Returns:</strong> The triangle's normal.</dt>
  555. </dl>
  556. </div>
  557. <h3 class="name name-method" id=".isFrontFacing" translate="no">.<a href="#.isFrontFacing">isFrontFacing</a><span class="signature">( a : <span class="param-type">Vector3</span>, b : <span class="param-type">Vector3</span>, c : <span class="param-type">Vector3</span>, direction : <span class="param-type">Vector3</span> )</span><span class="type-signature"> : boolean</span> </h3>
  558. <div class="method">
  559. <div class="description">
  560. <p>Returns <code>true</code> if the triangle is oriented towards the given direction.</p>
  561. </div>
  562. <table class="params">
  563. <tbody>
  564. <tr>
  565. <td class="name"><code>a</code></td>
  566. <td class="description last"><p>The first corner of the triangle.</p></td>
  567. </tr>
  568. <tr>
  569. <td class="name"><code>b</code></td>
  570. <td class="description last"><p>The second corner of the triangle.</p></td>
  571. </tr>
  572. <tr>
  573. <td class="name"><code>c</code></td>
  574. <td class="description last"><p>The third corner of the triangle.</p></td>
  575. </tr>
  576. <tr>
  577. <td class="name"><code>direction</code></td>
  578. <td class="description last"><p>The (normalized) direction vector.</p></td>
  579. </tr>
  580. </tbody>
  581. </table>
  582. <dl class="details">
  583. <dt class="tag-returns"><strong>Returns:</strong> Whether the triangle is oriented towards the given direction or not.</dt>
  584. </dl>
  585. </div>
  586. <h2 class="subsection-title">Source</h2>
  587. <p>
  588. <a href="https://github.com/mrdoob/three.js/blob/master/src/math/Triangle.js" target="_blank" rel="noopener" translate="no">src/math/Triangle.js</a>
  589. </p>
  590. </article>
  591. </section>
  592. <script src="../scripts/linenumber.js"></script>
  593. <script src="../scripts/page.js"></script>
  594. </body>
  595. </html>
粤ICP备19079148号