Main Content

本页翻译不是最新的。点击此处可查看最新英文版本。

boundaryshape

从二维三角剖分创建 polyshape

说明

示例

polyout = boundaryshape(TR) 从二维三角剖分的边界创建 polyshape 对象。TR 可以是 triangulation 对象或 delaunayTriangulation 对象。

创建 polyshape 对象 polyout 后,可以使用 polyshape 函数分析其属性或执行其他计算。例如,可以使用属性 polyout.Vertices 访问定义边界的顶点,使用命令 plot(polyout) 绘制形状。

[polyout,vertexID] = boundaryshape(TR) 还返回向量 vertexID,它将 polyshape 的顶点映射到三角剖分的顶点。

示例

全部折叠

创建并绘制简单的 triangulation 对象。

P = [2.5 8.0; 6.5 8.0; 2.5 5.0; 6.5 5.0; 1.0 6.5; 8.0 6.5];
T = [5 3 1; 3 2 1; 3 4 2; 4 6 2];
TR = triangulation(T,P);
triplot(TR)
xlim([0 9])
ylim([4.5 8.5])

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

创建并绘制一个 polyshape 对象,其边界等于三角剖分的边界。

polyout = boundaryshape(TR);
plot(polyout)

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

创建并绘制 triangulation 对象。

T = [5 1 3; 6 1 4; 5 4 1; 2 6 3; 3 6 5; 2 1 6];
P = [3 0.5; 3.5 1.5; 4 0.5; 3.25 0.6; 3.75 0.6; 3.5 1];
TR = triangulation(T,P);
triplot(TR)
xlim([2.8 4.2])
ylim([0.4 1.8])

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

创建并绘制一个 polyshape 对象,其边界等于三角剖分的边界。由于三角剖分的内部和外部闭合边界,polyout 同时包含孔边界和实心边界。

polyout = boundaryshape(TR)
polyout = 
  polyshape with properties:

      Vertices: [7x2 double]
    NumRegions: 1
      NumHoles: 1

plot(polyout)

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

输入参数

全部折叠

三角剖分,指定为二维 triangulation 对象或二维 delaunayTriangulation 对象。

输出参数

全部折叠

输出 polyshape,以 polyshape 对象形式返回。

顶点标识,以整数向量形式返回。vertexID 中的每个元素对应于 Points 属性中三角剖分顶点的行号。vertexID 的长度等于 polyshape 对象的 Vertices 属性中的行数。

数据类型: double

版本历史记录

在 R2018b 中推出