Is there a metric for computing the "scale" between two polygons?
조회 수: 2 (최근 30일)
이전 댓글 표시
I have two similarly shaped polygons, one of which has a smaller area, and both are centered about the same reference point. Is there a metric for describing or an algorithm for computing the scale between these two polygons? I would like to take the larger polygon and automatically scale it down to the smaller one.
Example: An octogon PG, with a hexagon sPG inside of it. Both are centered about (0,0). How do I automatically create a new polygon from PG that is roughly fitting sPG?
xOct = [2.922, 1.21, -1.21, -2.922, -2.922, -1.21, 1.21, 2.922];
yOct = [1.21, 2.922, 2.922, 1.21, -1.21, -2.922, -2.922, -1.21];
xHex = [1, 0.5, -0.5, -1, -0.5, 0.5];
yHex = [0, 0.86603, 0.86603, 0, -0.86603, -0.86603];
PG = polyshape( xOct, yOct );
sPG = polyshape( xHex, yHex );
cla;
PG.plot();
hold on;
sPG.plot();
% Need to solve for s.
% s = computeScalingFactor( PG, sPG )
answerPG = scale( PG, 0.3 ); % Second input should be s - ideally, 'computeScalingFactor' or whatever function used to compute s would be about 0.3.
answerPG.plot();
댓글 수: 0
답변 (1개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Elementary Polygons에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!