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 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