123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="utf-8" />
- <base href="../../../" />
- <script src="page.js"></script>
- <link type="text/css" rel="stylesheet" href="page.css" />
- </head>
- <body>
- <h1>[name]</h1>
- <p class="desc">
- A geometric triangle as defined by three [page:Vector3 Vector3s]
- representing its three corners.
- </p>
- <h2>Constructor</h2>
- <h3>[name]( [param:Vector3 a], [param:Vector3 b], [param:Vector3 c] )</h3>
- <p>
- [page:Vector3 a] - the first corner of the triangle. Default is a
- [page:Vector3] at `(0, 0, 0)`.<br />
- [page:Vector3 b] - the second corner of the triangle. Default is a
- [page:Vector3] at `(0, 0, 0)`.<br />
- [page:Vector3 c] - the final corner of the triangle. Default is a
- [page:Vector3] at `(0, 0, 0)`.<br /><br />
- Creates a new [name].
- </p>
- <h2>Properties</h2>
- <h3>[property:Vector3 a]</h3>
- <p>
- The first corner of the triangle. Default is a [page:Vector3] at `(0, 0,
- 0)`.
- </p>
- <h3>[property:Vector3 b]</h3>
- <p>
- The second corner of the triangle. Default is a [page:Vector3] at `(0, 0,
- 0)`.
- </p>
- <h3>[property:Vector3 c]</h3>
- <p>
- The final corner of the triangle. Default is a [page:Vector3] at `(0, 0,
- 0)`.
- </p>
- <h2>Methods</h2>
- <h3>[method:Triangle clone]()</h3>
- <p>
- Returns a new triangle with the same [page:.a a], [page:.b b] and [page:.c c]
- properties as this one.
- </p>
- <h3>
- [method:Vector3 closestPointToPoint]( [param:Vector3 point], [param:Vector3 target] )
- </h3>
- <p>
- [page:Vector3 point] - [page:Vector3] <br />
- [page:Vector3 target] — the result will be copied into this Vector3.<br /><br />
- Returns the closest point on the triangle to [page:Vector3 point].
- </p>
- <h3>[method:Boolean containsPoint]( [param:Vector3 point] )</h3>
- <p>
- [page:Vector3 point] - [page:Vector3] to check.<br /><br />
- Returns true if the passed point, when projected onto the plane of the
- triangle, lies within the triangle.
- </p>
- <h3>[method:this copy]( [param:Triangle triangle] )</h3>
- <p>
- Copies the values of the passed triangles's [page:.a a], [page:.b b] and
- [page:.c c] properties to this triangle.
- </p>
- <h3>[method:Boolean equals]( [param:Triangle triangle] )</h3>
- <p>
- Returns true if the two triangles have identical [page:.a a], [page:.b b]
- and [page:.c c] properties.
- </p>
- <h3>[method:Float getArea]()</h3>
- <p>Return the area of the triangle.</p>
- <h3>
- [method:Vector3 getBarycoord]( [param:Vector3 point], [param:Vector3 target] )
- </h3>
- <p>
- [page:Vector3 point] - [page:Vector3] <br />
- [page:Vector3 target] — the result will be copied into this Vector3.<br /><br />
- Return a [link:https://en.wikipedia.org/wiki/Barycentric_coordinate_system barycentric coordinate]
- from the given vector. Returns `null` if the triangle is degenerate.<br /><br />
- [link:http://commons.wikimedia.org/wiki/File:Barycentric_coordinates_1.png Picture of barycentric coordinates]
- </p>
- <h3>[method:Vector3 getMidpoint]( [param:Vector3 target] )</h3>
- <p>
- [page:Vector3 target] — the result will be copied into this Vector3.<br /><br />
- Calculate the midpoint of the triangle.
- </p>
- <h3>[method:Vector3 getNormal]( [param:Vector3 target] )</h3>
- <p>
- [page:Vector3 target] — the result will be copied into this Vector3.<br /><br />
- Calculate the [link:https://en.wikipedia.org/wiki/Normal_(geometry) normal vector] of the triangle.
- </p>
- <h3>[method:Plane getPlane]( [param:Plane target] )</h3>
- <p>
- [page:Plane target] — the result will be copied into this Plane.<br /><br />
- Calculate a [page:Plane plane] based on the triangle. .
- </p>
- <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>
- <p>
- [page:Vector3 point] - Position of interpolated point.<br />
- [page:Vector3 p1] - Position of first vertex.<br />
- [page:Vector3 p2] - Position of second vertex.<br />
- [page:Vector3 p3] - Position of third vertex.<br />
- [page:Vector v1] - Value of first vertex.<br />
- [page:Vector v2] - Value of second vertex.<br />
- [page:Vector v3] - Value of third vertex.<br />
- [page:Vector target] — Result will be copied into this Vector.<br /><br />
- Returns the value barycentrically interpolated for the given point on the
- triangle. Returns `null` if the triangle is degenerate.
- </p>
- <h3>
- [method:Vector getInterpolatedAttribute]( [param:BufferAttribute attribute], [param:Number i1], [param:Vector3 i2], [param:Number i3], [param:Vector3 barycoord], [param:Vector3 target] )
- </h3>
- <p>
- [page:BufferAttribute attribute] - The attribute to interpolate.<br />
- p1 - Index of first vertex.<br />
- p2 - Index of second vertex.<br />
- p3 - Index of third vertex.<br />
- barycoord - The barycoordinate value to use to interpolate.<br />
- [page:Vector target] — Result will be copied into this Vector.<br /><br />
- Returns the value barycentrically interpolated for the given attribute and indices.
- </p>
- <h3>[method:Boolean intersectsBox]( [param:Box3 box] )</h3>
- <p>
- [page:Box3 box] - Box to check for intersection against.<br /><br />
- Determines whether or not this triangle intersects [page:Box3 box].
- </p>
- <h3>[method:Boolean isFrontFacing]( [param:Vector3 direction] )</h3>
- <p>
- [page:Vector3 direction] - The direction to test.<br /><br />
- Whether the triangle is oriented towards the given direction or not.
- </p>
- <h3>
- [method:this set]( [param:Vector3 a], [param:Vector3 b], [param:Vector3 c] )
- </h3>
- <p>
- Sets the triangle's [page:.a a], [page:.b b] and [page:.c c] properties to
- the passed [page:Vector3 vector3s].<br />
- Please note that this method only copies the values from the given
- objects.
- </p>
- <h3>
- [method:this setFromAttributeAndIndices]( [param:BufferAttribute attribute],
- [param:Integer i0], [param:Integer i1], [param:Integer i2] )
- </h3>
- <p>
- attribute - [page:BufferAttribute] of vertex data <br />
- i0 - [page:Integer] index <br />
- i1 - [page:Integer] index <br />
- i2 - [page:Integer] index<br /><br />
- Sets the triangle's vertices from the buffer attribute vertex data.
- </p>
- <h3>
- [method:this setFromPointsAndIndices]( [param:Array points], [param:Integer i0], [param:Integer i1], [param:Integer i2] )
- </h3>
- <p>
- points - [page:Array] of [page:Vector3]s <br />
- i0 - [page:Integer] index <br />
- i1 - [page:Integer] index <br />
- i2 - [page:Integer] index<br /><br />
- Sets the triangle's vectors to the vectors in the array.
- </p>
- <h2>Source</h2>
- <p>
- [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
- </p>
- </body>
- </html>
|