이 번역 페이지는 최신 내용을 담고 있지 않습니다. 최신 내용을 영문으로 보려면 여기를 클릭하십시오.
centroid
polyshape
의 중심
설명
예제
다각형의 중심
복수의 영역을 가진 다각형의 중심을 구합니다.
2개의 채워진 영역을 가진 다각형을 만들고 중심을 구합니다.
x1 = [0 1 2]; y1 = [0 1 0]; x2 = [2 3 4]; y2 = [1 2 1]; polyin = polyshape({x1,x2},{y1,y2}); [x,y] = centroid(polyin); plot(polyin) hold on plot(x,y,'r*') hold off
각 영역의 중심을 개별적으로 구하려면 두 번째 인수에 각 영역의 경계 인덱스를 지정하십시오.
[x,y] = centroid(polyin,[1 2]); plot(polyin) hold on plot(x(1),y(1),'r*',x(2),y(2),'r*') hold off
또는 먼저 두 영역을 개별적인 polyshape
객체로 구분한 다음 각 영역의 중심을 구할 수도 있습니다. regions
함수를 사용하여 polyshape
객체로 구성된 배열을 만듭니다. 여기서 배열의 각 요소는 삼각형 영역 중 하나를 정의하는 polyshape
입니다.
polyarray = regions(polyin)
polyarray = 2x1 polyshape array with properties: Vertices NumRegions NumHoles
[x,y] = centroid(polyarray)
x = 2×1
1
3
y = 2×1
0.3333
1.3333
입력 인수
polyin
— 입력 polyshape
스칼라 | 벡터 | 행렬 | 다차원 배열
입력 polyshape
로, 스칼라, 벡터, 행렬 또는 다차원 배열로 지정됩니다.
데이터형: polyshape
I
— 경계 인덱스
정수 스칼라 | 정수 벡터
경계 인덱스로, 정수 스칼라 또는 정수 벡터로 지정됩니다. I
의 각 요소는 입력 polyshape
의 단일 경계에 대응합니다.
데이터형: double
| single
| int8
| int16
| int32
| int64
| uint8
| uint16
| uint32
| uint64
출력 인수
x
— x좌표
스칼라 | 벡터 | 행렬 | 다차원 배열
polyshape
의 중심의 x 좌표로, 스칼라, 벡터, 행렬 또는 다차원 배열로 반환됩니다. 입력값이 polyshape
객체로 구성된 배열인 경우 x
는 각 polyshape
의 중심의 x 좌표를 포함합니다.
y
— y좌표
스칼라 | 벡터 | 행렬 | 다차원 배열
polyshape
의 중심의 y 좌표로, 스칼라, 벡터, 행렬 또는 다차원 배열로 반환됩니다. 입력값이 polyshape
객체로 구성된 배열인 경우 y
는 각 polyshape
의 중심의 y 좌표를 포함합니다.
버전 내역
R2017b에 개발됨
MATLAB 명령
다음 MATLAB 명령에 해당하는 링크를 클릭했습니다.
명령을 실행하려면 MATLAB 명령 창에 입력하십시오. 웹 브라우저는 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)