Main Content

TriRep

(Not recommended) Triangulation representation

TriRep is not recommended. Use triangulation instead.

Description

TriRep provides topological and geometric queries for triangulations in 2-D and 3-D space. For example, for triangular meshes you can query triangles attached to a vertex, triangles that share an edge, neighbor information, circumcenters, or other features. You can create a TriRep directly using existing triangulation data. Alternatively, you can create a Delaunay triangulation, via DelaunayTri, which also provides access to the TriRep functionality.

Creation

Description

TR = TriRep(tri,x,y) creates a 2-D triangulation representation from the triangulation matrix tri and the vertex coordinates (x,y).

example

TR = TriRep(tri,x,y,z) creates a 3-D triangulation representation from the triangulation matrix tri and the vertex coordinates (x,y,z).

TR = TriRep(tri,P) creates a triangulation representation from the triangulation matrix tri and the vertex coordinates matrix P.

Input Arguments

expand all

Triangulation representation, specified as a matrix that defines the triangulation:

  • For 2-D triangulations, tri is an m-by-3 matrix that defines the triangulation in face-vertex format, where m is the number of triangles. Each row in tri defines a triangle by indices into the column vectors of vertex coordinates (x,y).

  • For 3-D triangulations, tri is an m-by-3 or m-by-4 matrix that defines the triangulation in simplex-vertex format, where m is the number of simplices; triangles or tetrahedra in this case. Each row of tri is a simplex defined by indices into the column vectors of vertex coordinates (x,y,z).

Vertex coordinates, specified as column vectors.

Vertex coordinates, specified as a matrix. P is a mpts-by-ndim matrix, where mpts is the number of points and ndim is the dimension of the space where the points reside (2-D or 3-D).

Properties

expand all

Coordinates of the points in the triangulation, returned as a matrix. X is a mpts-by-ndim matrix, where mpts is the number of points and ndim is the dimension of the space where the points reside (2-D or 3-D).

Triangulation data structure, returned as a matrix. Each row of Triangulation is a simplex (triangle or tetrahedra) defined by indices into the rows of vertex coordinates in X.

Object Functions

In addition to the below object functions, TriRep objects support indexing into the triangulation using parentheses (). The syntax is the same as for arrays.

baryToCart(Not recommended) Convert point coordinates from barycentric to Cartesian
cartToBary(Not recommended) Convert point coordinates from Cartesian to barycentric
circumcenters(Not recommended) Circumcenters of specified simplices
edgeAttachments(Not recommended) Triangles or tetrahedra attached to specified edge
edges(Not recommended) Triangulation edges
faceNormals(Not recommended) Unit normals to specified triangles
featureEdges(Not recommended) Sharp edges of surface triangulation
freeBoundary(Not recommended) Free boundary facets
incenters(Not recommended) Incenters of specified simplices
isEdge(Not recommended) Test if vertices are joined by edge
neighbors(Not recommended) Triangle or tetrahedron neighbors
size(Not recommended) Size of triangulation matrix
vertexAttachments(Not recommended) Triangles or tetrahedra attached to vertex

Examples

collapse all

Create a 2-D triangulation and plot the free boundary edges.

Load a 2-D triangulation tri and vertex coordinates x, y.

load trimesh2d

Use the TriRep constructor and freeBoundary method to build an array of the free boundary edges. Plot the triangulation.

trep = TriRep(tri,x,y);
fe = freeBoundary(trep)';
triplot(trep)
axis equal

Figure contains an axes object. The axes object contains an object of type line.

Add the free edges fe to the plot.

hold on
plot(x(fe), y(fe), 'r','LineWidth',2)
hold off

Figure contains an axes object. The axes object contains 181 objects of type line.

Version History

Introduced in R2009a