|
@@ -10,7 +10,10 @@
|
|
|
<body>
|
|
|
<h1>[name]</h1>
|
|
|
|
|
|
- <div class="desc">A geometric triangle as defined by three vectors.</div>
|
|
|
+ <div class="desc">
|
|
|
+ A geometric triangle as defined by three [page:Vector3 Vector3s] representing its
|
|
|
+ three corners.
|
|
|
+ </div>
|
|
|
|
|
|
|
|
|
<h2>Constructor</h2>
|
|
@@ -18,12 +21,11 @@
|
|
|
|
|
|
<h3>[name]( [page:Vector3 a], [page:Vector3 b], [page:Vector3 c] )</h3>
|
|
|
<div>
|
|
|
- a -- [page:Vector3] <br />
|
|
|
- b -- [page:Vector3] <br />
|
|
|
- c -- [page:Vector3]
|
|
|
- </div>
|
|
|
- <div>
|
|
|
- Sets the triangle's vectors to the passed vectors.
|
|
|
+ [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).
|
|
|
+
|
|
|
+ Created a new [name].
|
|
|
</div>
|
|
|
|
|
|
|
|
@@ -33,119 +35,100 @@
|
|
|
|
|
|
<h3>[property:Vector3 a]</h3>
|
|
|
<div>
|
|
|
- The first [page:Vector3] of the triangle.
|
|
|
+ The first corner of the triangle. Default is a [page:Vector3] at (0, 0, 0).
|
|
|
</div>
|
|
|
|
|
|
<h3>[property:Vector3 b]</h3>
|
|
|
<div>
|
|
|
- The second [page:Vector3] of the triangle.
|
|
|
+ The second corner of the triangle. Default is a [page:Vector3] at (0, 0, 0).
|
|
|
</div>
|
|
|
|
|
|
<h3>[property:Vector3 c]</h3>
|
|
|
<div>
|
|
|
- The third [page:Vector3] of the triangle.
|
|
|
+ the final corner of the triangle. Default is a [page:Vector3] at (0, 0, 0)
|
|
|
</div>
|
|
|
|
|
|
<h2>Methods</h2>
|
|
|
|
|
|
+ <h3>[method:Float area]()</h3>
|
|
|
+ <div>Return the area of the triangle.</div>
|
|
|
|
|
|
-
|
|
|
- <h3>[method:Triangle setFromPointsAndIndices]( [page:Array points], [page:Integer i0], [page:Integer i1], [page:Integer i2] ) [page:Triangle this]</h3>
|
|
|
- <div>
|
|
|
- points -- [page:Array] of [page:Vector3]s <br />
|
|
|
- i0 -- [page:Integer] index <br />
|
|
|
- i1 -- [page:Integer] index <br />
|
|
|
- i2 -- [page:Integer] index
|
|
|
- </div>
|
|
|
+ <h3>[method:Vector3 barycoordFromPoint]( [page:Vector3 point], [page:Vector3 optionalTarget] )</h3>
|
|
|
<div>
|
|
|
- Sets the triangle's vectors to the vectors in the array.
|
|
|
- </div>
|
|
|
+ [page:Vector3 point] - [page:Vector3] <br />
|
|
|
+ [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 />
|
|
|
|
|
|
- <h3>[method:Triangle set]( [page:Vector3 a], [page:Vector3 b], [page:Vector3 c] ) [page:Triangle this]</h3>
|
|
|
- <div>
|
|
|
- a -- [page:Vector3] <br />
|
|
|
- b -- [page:Vector3] <br />
|
|
|
- c -- [page:Vector3]
|
|
|
- </div>
|
|
|
- <div>
|
|
|
- Sets the triangle's vectors to the passed vectors.
|
|
|
- </div>
|
|
|
+ Return a [link:https://en.wikipedia.org/wiki/Barycentric_coordinate_system barycentric coordinate]
|
|
|
+ from the given vector. <br/><br/>
|
|
|
|
|
|
- <h3>[method:Vector3 normal]( [page:Vector3 optionalTarget] )</h3>
|
|
|
- <div>
|
|
|
- optionalTarget -- Optional [page:Vector3] target to set the result.
|
|
|
- </div>
|
|
|
+ [link:http://commons.wikimedia.org/wiki/File:Barycentric_coordinates_1.png Picture of barycentric coordinates]
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <h3>[method:Triangle clone]()</h3>
|
|
|
<div>
|
|
|
- Return the calculated normal of the triangle.
|
|
|
+ Returns a new triangle with the same [page:.a a], [page:.b b] and [page:.c c] properties as this one.
|
|
|
</div>
|
|
|
|
|
|
- <h3>[method:Vector3 barycoordFromPoint]( [page:Vector3 point], [page:Vector3 optionalTarget] )</h3>
|
|
|
+ <h3>[method:Vector3 closestPointToPoint]( [page:Vector3 point], [page:Vector3 optionalTarget] )</h3>
|
|
|
<div>
|
|
|
- point -- [page:Vector3] <br />
|
|
|
- optionalTarget -- Optional [page:Vector3] target to set the result.
|
|
|
+ point - [page:Vector3] <br />
|
|
|
+ [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 />
|
|
|
+
|
|
|
+ Returns the closest point on the triangle to [page:Vector3 point].
|
|
|
</div>
|
|
|
+
|
|
|
+ <h3>[method:Boolean containsPoint]( [page:Vector3 point] )</h3>
|
|
|
<div>
|
|
|
- Return a barycentric coordinate from the given vector. <br/><br/>
|
|
|
- [link:http://commons.wikimedia.org/wiki/File:Barycentric_coordinates_1.png](Picture of barycentric coordinates)
|
|
|
+ [page:Vector3 point] - [page:Vector3] to check.<br /><br />
|
|
|
+
|
|
|
+ Returns true if the passed vector is within the triangle.
|
|
|
</div>
|
|
|
|
|
|
- <h3>[method:Triangle clone]()</h3>
|
|
|
+ <h3>[method:Triangle copy]( [page:Triangle triangle] )</h3>
|
|
|
<div>
|
|
|
- Return a new copy of this triangle.
|
|
|
+ Copies the values of the passed triangles's [page:.a a], [page:.b b] and [page:.c c]
|
|
|
+ properties to this triangle.
|
|
|
</div>
|
|
|
|
|
|
- <h3>[method:Float area]()</h3>
|
|
|
+ <h3>[method:Boolean equals]( [page:Triangle triangle] )</h3>
|
|
|
<div>
|
|
|
- Return the area of the triangle.
|
|
|
+ Returns true if the two triangles have identical [page:.a a], [page:.b b] and [page:.c c] properties.
|
|
|
</div>
|
|
|
|
|
|
<h3>[method:Vector3 midpoint]( [page:Vector3 optionalTarget] )</h3>
|
|
|
<div>
|
|
|
- optionalTarget -- Optional [page:Vector3] target to set the result.
|
|
|
- </div>
|
|
|
- <div>
|
|
|
- Return the midpoint of the triangle. Optionally sets a target vector.
|
|
|
- </div>
|
|
|
+ [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 />
|
|
|
|
|
|
- <h3>[method:Boolean equals]( [page:Triangle triangle] )</h3>
|
|
|
- <div>
|
|
|
- triangle -- [page:Triangle]
|
|
|
+ Calculate the midpoint of the triangle.
|
|
|
</div>
|
|
|
+
|
|
|
+ <h3>[method:Vector3 normal]( [page:Vector3 optionalTarget] )</h3>
|
|
|
<div>
|
|
|
- Checks to see if two triangles are equal (share the same vectors).
|
|
|
+ [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 />
|
|
|
+
|
|
|
+ Calculate the [link:https://en.wikipedia.org/wiki/Normal_(geometry) normal vector] of the triangle.
|
|
|
</div>
|
|
|
|
|
|
<h3>[method:Plane plane]( [page:Plane optionalTarget] )</h3>
|
|
|
<div>
|
|
|
- optionalTarget -- Optional [page:Plane] target to set the result.
|
|
|
- </div>
|
|
|
- <div>
|
|
|
- Return a [page:Plane plane] based on the triangle. Optionally sets a target plane.
|
|
|
- </div>
|
|
|
+ [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 />
|
|
|
|
|
|
- <h3>[method:Boolean containsPoint]( [page:Vector3 point] )</h3>
|
|
|
- <div>
|
|
|
- point -- [page:Vector3]
|
|
|
- </div>
|
|
|
- <div>
|
|
|
- Checks to see if the passed vector is within the triangle.
|
|
|
+ Create a [page:Plane plane] based on the triangle. .
|
|
|
</div>
|
|
|
|
|
|
- <h3>[method:Vector3 closestPointToPoint]( [page:Vector3 point], [page:Vector3 optionalTarget] )</h3>
|
|
|
- <div>
|
|
|
- point -- [page:Vector3] <br />
|
|
|
- optionalTarget -- Optional [page:Vector3] target to set the result.
|
|
|
- </div>
|
|
|
+ <h3>[method:Triangle set]( [page:Vector3 a], [page:Vector3 b], [page:Vector3 c] ) [page:Triangle this]</h3>
|
|
|
<div>
|
|
|
- Returns the closest point on the triangle.
|
|
|
+ Sets the triangle's [page:.a a], [page:.b b] and [page:.c c] properties to the passed [page:vector3 vector3s].
|
|
|
</div>
|
|
|
|
|
|
- <h3>[method:Triangle copy]( [page:Triangle triangle] )</h3>
|
|
|
- <div>
|
|
|
- triangle -- [page:Triangle]
|
|
|
- </div>
|
|
|
+ <h3>[method:Triangle setFromPointsAndIndices]( [page:Array points], [page:Integer i0], [page:Integer i1], [page:Integer i2] ) [page:Triangle this]</h3>
|
|
|
<div>
|
|
|
- Copies the values of the vertices of the passed triangle to this triangle.
|
|
|
+ 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.
|
|
|
</div>
|
|
|
|
|
|
<h2>Source</h2>
|