Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

isInterior

Class: delaunayTriangulation

Test if triangle is in interior of 2-D constrained Delaunay triangulation

Syntax

tf = isInterior(DT)

Description

tf = isInterior(DT) returns an array of logical values that indicate whether the triangles in a constrained Delaunay triangulation are inside the bounded geometric domain. A triangle, DT.ConnectivityList(j,:), is classified as inside the domain when tf(j) is true. Otherwise, the triangle is outside the domain.

Input Arguments

DT

A 2-D delaunayTriangulation that has a set of constrained edges that define a bounded geometric domain.

Output Arguments

tf

Logical values, returned as a column vector. Element tf(j) is true when the triangle whose ID is j is inside the domain of DT.

Definitions

Triangle ID

A row number of the matrix, DT.ConnectivityList. You use this ID to refer a specific triangle.

Examples

expand all

Create a geometric domain whose shape is a square frame.

outerprofile = [-5 -5; -3 -5; -1 -5;  1 -5;
                 3 -5;  5 -5;  5 -3;  5 -1;
                 5  1;  5  3;  5  5;  3  5;
                 1  5; -1  5; -3  5; -5  5;
                -5  3; -5  1; -5 -1; -5 -3];

innerprofile = outerprofile.*0.5;
profile = [outerprofile; innerprofile];

Define the edge constraints.

outercons = [(1:19)' (2:20)'; 20 1;];
innercons = [(21:39)' (22:40)'; 40 21];
C = [outercons; innercons];

Create the constrained Delaunay triangulation.

DT = delaunayTriangulation(profile,C);

Plot the triangulation.

figure
subplot(1,2,1)
triplot(DT)

% Highlight the inner square in red.
hold on
plot(DT.Points(innercons',1),DT.Points(innercons',2),...
     '-r','LineWidth',2)

% Highlight the outer square in red and resize the |x| and |y| axes to make
% the plot square.
plot(DT.Points(outercons',1),DT.Points(outercons',2), ...
     '-r','LineWidth', 2)
axis equal

% Plot only the triangles that lie inside of the domain.
hold off
subplot(1,2,2)
inside = isInterior(DT);
triplot(DT.ConnectivityList(inside, :),DT.Points(:,1),DT.Points(:,2))

% Highlight the inner and outer squares in red.
hold on
plot(DT.Points(outercons',1),DT.Points(outercons',2), ...
     '-r','LineWidth', 2)
plot(DT.Points(innercons',1),DT.Points(innercons',2), ...
     '-r','LineWidth', 2)
axis equal
hold off

See Also

Was this topic helpful?