decsg ignores a shape

15 ビュー (過去 30 日間)
Alexander
Alexander 2019 年 3 月 28 日
編集済み: Alexander 2019 年 3 月 29 日
I use decsg to iteratively create a simple geometry representing a circle minus a polygon, where circle is constant and the polygon changes from one iteration to another. At each iteration I have:
O = [1, 0, 0, 2]'; % A circle with the centre at (0,0) and radius 2
n = size(PolyCoord,1); % PolyCoord is a n-by-2 array with the x- and y-coordinates of the polygon's points
P = [2, n, PolyCoord(:,1)',PolyCoord(:,2)']'; % Polygon
O = [O; zeros(length(I) - length(O),1)]; % Additional zeros
gm = [O,I];
sf = 'O-I';
ns = char('O','I')';
g = decsg(gm,sf,ns); % Generate geometry
I run this code for different PolyCoord, but O is always the same. However, for some reason, O is sometimes ignored, and g represents just the polygon P. The polygon is always inside the circle, the matrices consisteny is checked.
A slight change of the centre's coordinates can help:
eps = 1e-2;
O = [1, eps, eps, 2]';
However, is there a more systematic solution to this problem?

回答 (0 件)

カテゴリ

Help Center および File ExchangeGeometry and Mesh についてさらに検索

製品


リリース

R2018a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by