Main Content

isInterior

德劳内三角剖分内的查询点

说明

示例

TF = isInterior(DT) 返回逻辑值列向量,用于指示二维约束德劳内三角剖分中的三角形是否在有界的几何域内。当 DT 中对应的三角形位于该域内时,TF 的元素为 1 (true),否则为 0 (false)。

示例

全部折叠

计算并绘制受约束的二维德劳内三角剖分在指定边界内的三角形。

创建形状为正方形框架的几何域。

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;
P = [outerprofile; innerprofile];

定义边约束。

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

创建受约束的德劳内三角剖分。

DT = delaunayTriangulation(P,C);

绘制三角形,并用红色突出显示内部和外部正方形。

triplot(DT)  
hold on 
plot(DT.Points(innercons',1),DT.Points(innercons',2), ...
     '-r','LineWidth',2)  
plot(DT.Points(outercons',1),DT.Points(outercons',2), ...
     '-r','LineWidth',2)
axis equal  

仅绘制内部和外部正方形之间的三角形,并用红色突出显示内部和外部正方形。

figure
TF = isInterior(DT);
triplot(DT.ConnectivityList(TF,:),DT.Points(:,1),DT.Points(:,2))  
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

输入参数

全部折叠

受约束的德劳内三角剖分,指定为二维标量 delaunayTriangulation 对象,通过一组受约束的边来定义一个有界的几何域。有界域是指由多个不相交、不重叠的约束边围成的封闭区域。

数据类型: delaunayTriangulation

提示

  • 当边界约束相交或重叠时,isInterior 会产生不正确或不一致的结果。为了避免这种行为,请使用能够构成一个或多个不相交、不重叠的闭合边界的约束。当边界约束嵌套在一起,不相交也不重叠时,内部或外部状态跨边界交替出现。

扩展功能

基于线程的环境
使用 MATLAB® backgroundPool 在后台运行代码或使用 Parallel Computing Toolbox™ ThreadPool 加快代码运行速度。

版本历史记录

在 R2013a 中推出