Triangle
Introduction
vtkTriangle is a cell which representant a triangle. It contains static method to make some computations directly link to triangle.
See Also
vtkCell
Methods
cellBoundary
Get the nearest cell boundary to the specified parametric coordinates and whether the point is inside or outside the cell.
| Argument | Type | Required | Description |
|---|---|---|---|
subId | Number | Yes | The sub-id of the cell. |
pcoords | Vector3 | Yes | The parametric coordinates. |
pts | Vector2 | Yes | The points of the cell. |
computeNormal
Compute the normalized normal of a triangle composed of three points. The normal is returned in normal.
| Argument | Type | Required | Description |
|---|---|---|---|
v1 | Vector3 | Yes | The first point coordinate. |
v2 | Vector3 | Yes | The second point coordinate. |
v3 | Vector3 | Yes | The third point coordinate. |
n | Vector3 | Yes | The normal coordinate. |
computeNormalDirection
Compute the normal direction according to the three vertex which composed a triangle. The normal is not normalized. The normal is returned in normal.
| Argument | Type | Required | Description |
|---|---|---|---|
v1 | Vector3 | Yes | The first point coordinate. |
v2 | Vector3 | Yes | The second point coordinate. |
v3 | Vector3 | Yes | The third point coordinate. |
n | Vector3 | Yes | The normal coordinate. |
derivatives
Get the derivatives of the triangle at the specified parametric coordinates.
| Argument | Type | Required | Description |
|---|---|---|---|
subId | Number | Yes | - The sub-id of the triangle. |
pcoords | Vector3 | Yes | - The parametric coordinates. |
values | Array[Number] | Yes | - The values at the points. |
dim | Number | Yes | - The dimension. |
derivs | Array[Number] | Yes | - The derivatives. |
evaluateLocation
Determine global coordinates (x) from the given subId and parametric coordinates.
| Argument | Type | Required | Description |
|---|---|---|---|
pcoords | Vector3 | Yes | The parametric coordinates. |
x | Vector3 | Yes | The x point coordinate. |
weights | Array[Number] | Yes | The number of weights. |
evaluatePosition
Evaluates whether the specified point is inside (1), outside (0), or indeterminate (-1) for the cell; computes parametric coordinates, sub-cell ID (if applicable), squared distance to the cell (and closest point if requested), and interpolation weights for the cell.
| Argument | Type | Required | Description |
|---|---|---|---|
x | Vector3 | Yes | The x point coordinate. |
closestPoint | Vector3 | Yes | The closest point coordinate. |
pcoords | Vector3 | Yes | The parametric coordinates. |
weights | Array[Number] | Yes | The number of weights. |
extend
Method used to decorate a given object (publicAPI+model) with vtkTriangle characteristics.
| Argument | Type | Required | Description |
|---|---|---|---|
publicAPI | Yes | object on which methods will be bounds (public) | |
model | Yes | object on which data structure will be bounds (protected) | |
initialValues | ITriangleInitialValues | No | (default: {}) |
getCellDimension
Get the topological dimensional of the cell (0, 1, 2 or 3).
getParametricDistance
Get the distance of the parametric coordinate provided to the cell.
| Argument | Type | Required | Description |
|---|---|---|---|
pcoords | Vector3 | Yes | The parametric coordinates. |
interpolationDerivs
Compute the interpolation functions/derivatives
| Argument | Type | Required | Description |
|---|---|---|---|
derivs | Array[Number] | Yes | - The derivatives. |
intersectWithLine
Compute the intersection point of the intersection between triangle and line defined by p1 and p2. tol Tolerance use for the position evaluation x is the point which intersect triangle (computed in function) pcoords parametric coordinates (computed in function) A javascript object is returned :
{
evaluation: define if the triangle has been intersected or not
subId: always set to 0
t: parametric coordinate along the line.
betweenPoints: Define if the intersection is between input points
}| Argument | Type | Required | Description |
|---|---|---|---|
p1 | Vector3 | Yes | The first point coordinate. |
p2 | Vector3 | Yes | The second point coordinate. |
tol | Number | Yes | The tolerance to use. |
x | Vector3 | Yes | The point which intersect triangle. |
pcoords | Vector3 | Yes | The parametric coordinates. |
intersectWithTriangle
Compute the intersection between two triangles.
| Argument | Type | Required | Description |
|---|---|---|---|
p1 | Vector3 | Yes | The first point coordinate of the first triangle. |
q1 | Vector3 | Yes | The second point coordinate of the first triangle. |
r1 | Vector3 | Yes | The third point coordinate of the first triangle. |
p2 | Vector3 | Yes | The first point coordinate of the second triangle. |
q2 | Vector3 | Yes | The second point coordinate of the second triangle. |
r2 | Vector3 | Yes | The third point coordinate of the second triangle. |
newInstance
Method used to create a new instance of vtkTriangle.
| Argument | Type | Required | Description |
|---|---|---|---|
initialValues | ITriangleInitialValues | No | for pre-setting some of its content |