2026a

# numsides


polyshape 的边数

函数库: TyMath

# 语法

N = numsides(polyin)
N = numsides(polyin,I)

# 说明

N = numsides(polyin) 返回 polyshape 对象的边数。示例

N = numsides(polyin,I) 返回 polyin 的第 I 个边界的边数。 仅当 polyin 是标量 polyshape 对象时,才支持此语法。

# 示例

多边形的边数

创建一个多边形,然后确定它的边数。

using TyMath
t = 0:0.5:2*pi;
P = [cos.(t) sin.(t)];
polyin = polyshape(P);
plot(polyin)
N = numsides(polyin)
N = 13

# 输入参数

polyin — 输入 polyshape
标量 | 向量 | 矩阵 | 多维数组

输入 polyshape,指定为标量、向量、矩阵或多维数组。

数据类型: polyshape

I — 边界索引
整数标量

边界索引,指定为整数标量或由整数组成的向量。I 对应于输入 polyshape 的边界。

数据类型: Int64 | Int32 | Int16 | Int128 | UInt8 | UInt16 | UInt32 | UInt64

# 另请参阅

polyshape | numboundaries