decsg ignores a shape

14 次查看(过去 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 CenterFile Exchange 中查找有关 Geometry and Mesh 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by