boundaryshape

Converts the boundary of a 2-D triangulation into a polyshape.

Category: Mathematics > Computational Geometry

Syntax

pshape = boundaryshape(TR)

Returns a polyshape that covers the area of the 2-D triangulation TR.

Description

The edges that belong to exactly one triangle form the outline of the mesh. boundaryshape links them into closed loops and builds a polyshape, so area, perimeter, point-in-polygon tests and Boolean operations become available for a mesh.

A triangulation that is not two-dimensional is rejected with an error.

Input arguments

TR
A 2-D triangulation (or delaunayTriangulation) object.

Output arguments

pshape
A polyshape whose outer boundary follows the triangulation's free edges.

Example

Polyshape from a triangle mesh

x = [0 1 1 0 0.5]';
y = [0 0 1 1 0.5]';
tr = triangulation([1 2 5; 2 3 5; 3 4 5; 4 1 5], [x y]);
ps = boundaryshape(tr);
disp(area(ps))
disp(ps.NumRegions)
Output
     1
     1

See also

polyshape triangulation freeBoundary boundary