decsg ignores a shape
14 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Antworten (0)
Siehe auch
Kategorien
Mehr zu Geometry and Mesh finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!