nsidedpoly
正多边形
说明
pgon = nsidedpoly(
使用一个或多个名称-值对组参量指定多边形的其他属性。例如,n
,Name,Value
)pgon = nsidedpoly(4,'SideLength',5)
创建一个以 (0,0) 为中心,边长为 5 的正方形。
示例
输入参数
n
— 边数
正整数标量
多边形的边数,指定为大于 2 的正整数标量。
数据类型: double
| single
| int8
| int16
| int32
| int64
| uint8
| uint16
| uint32
| uint64
名称-值参数
将可选的参量对组指定为 Name1=Value1,...,NameN=ValueN
,其中 Name
是参量名称,Value
是对应的值。名称-值参量必须出现在其他参量之后,但参量对组的顺序无关紧要。
在 R2021a 之前,使用逗号分隔每个名称和值,并用引号将 Name
引起来。
示例: pgon = nsidedpoly(3,'Radius',10)
Center
— 中心点
1×2 行向量
多边形的中心点,指定为以逗号分隔的对组,该对组由 'Center'
和一个 1×2 的行向量组成,行向量的第一个元素为点的 x 坐标,第二个元素为点的 y 坐标。
数据类型: double
| single
| int8
| int16
| int32
| int64
| uint8
| uint16
| uint32
| uint64
Radius
— 半径
正标量
多边形的外接圆半径,指定为以逗号分隔的对组,该对组由 'Radius'
和一个正标量组成。此名称-值对组不能与 'SideLength'
名称-值对组一起使用。
数据类型: double
| single
| int8
| int16
| int32
| int64
| uint8
| uint16
| uint32
| uint64
SideLength
— 边长
正标量
多边形的边长,指定为以逗号分隔的对组,该对组由 'SideLength'
和一个正标量组成。此名称-值对组不能与 'Radius'
名称-值对组一起使用。
数据类型: double
| single
| int8
| int16
| int32
| int64
| uint8
| uint16
| uint32
| uint64
扩展功能
C/C++ 代码生成
使用 MATLAB® Coder™ 生成 C 代码和 C++ 代码。
用法说明和限制:
名称在名称-值参量中必须为编译时常量。
必须启用动态内存分配。
polyshape
对象不能为入口函数的输入或输出。循环外的
polyshape
对象无法引用在循环内分配的polyshape
对象。有关详细信息,请参阅Handle Object Limitations for Code Generation (MATLAB Coder)。
版本历史记录
在 R2017b 中推出
另请参阅
MATLAB 命令
您点击的链接对应于以下 MATLAB 命令:
请在 MATLAB 命令行窗口中直接输入以执行命令。Web 浏览器不支持 MATLAB 命令。
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)