Skip to content

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.

ArgumentTypeRequiredDescription
subIdNumberYesThe sub-id of the cell.
pcoordsVector3YesThe parametric coordinates.
ptsVector2YesThe points of the cell.

computeNormal

Compute the normalized normal of a triangle composed of three points. The normal is returned in normal.

ArgumentTypeRequiredDescription
v1Vector3YesThe first point coordinate.
v2Vector3YesThe second point coordinate.
v3Vector3YesThe third point coordinate.
nVector3YesThe 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.

ArgumentTypeRequiredDescription
v1Vector3YesThe first point coordinate.
v2Vector3YesThe second point coordinate.
v3Vector3YesThe third point coordinate.
nVector3YesThe normal coordinate.

derivatives

Get the derivatives of the triangle at the specified parametric coordinates.

ArgumentTypeRequiredDescription
subIdNumberYes- The sub-id of the triangle.
pcoordsVector3Yes- The parametric coordinates.
valuesArray[Number]Yes- The values at the points.
dimNumberYes- The dimension.
derivsArray[Number]Yes- The derivatives.

evaluateLocation

Determine global coordinates (x) from the given subId and parametric coordinates.

ArgumentTypeRequiredDescription
pcoordsVector3YesThe parametric coordinates.
xVector3YesThe x point coordinate.
weightsArray[Number]YesThe 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.

ArgumentTypeRequiredDescription
xVector3YesThe x point coordinate.
closestPointVector3YesThe closest point coordinate.
pcoordsVector3YesThe parametric coordinates.
weightsArray[Number]YesThe number of weights.

extend

Method used to decorate a given object (publicAPI+model) with vtkTriangle characteristics.

ArgumentTypeRequiredDescription
publicAPIYesobject on which methods will be bounds (public)
modelYesobject on which data structure will be bounds (protected)
initialValuesITriangleInitialValuesNo(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.

ArgumentTypeRequiredDescription
pcoordsVector3YesThe parametric coordinates.

interpolationDerivs

Compute the interpolation functions/derivatives

ArgumentTypeRequiredDescription
derivsArray[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 :

js
{
   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
}
ArgumentTypeRequiredDescription
p1Vector3YesThe first point coordinate.
p2Vector3YesThe second point coordinate.
tolNumberYesThe tolerance to use.
xVector3YesThe point which intersect triangle.
pcoordsVector3YesThe parametric coordinates.

intersectWithTriangle

Compute the intersection between two triangles.

ArgumentTypeRequiredDescription
p1Vector3YesThe first point coordinate of the first triangle.
q1Vector3YesThe second point coordinate of the first triangle.
r1Vector3YesThe third point coordinate of the first triangle.
p2Vector3YesThe first point coordinate of the second triangle.
q2Vector3YesThe second point coordinate of the second triangle.
r2Vector3YesThe third point coordinate of the second triangle.

newInstance

Method used to create a new instance of vtkTriangle.

ArgumentTypeRequiredDescription
initialValuesITriangleInitialValuesNofor pre-setting some of its content