Geometry package: Difference between revisions

Jump to navigation Jump to search
Line 32: Line 32:
We are going to reduce the amount of points of the polygon in a drastic and destructive way (i.e. the shape may be considerably damaged). The codes to do so follows, in the future a better procedure will be published here.
We are going to reduce the amount of points of the polygon in a drastic and destructive way (i.e. the shape may be considerably damaged). The codes to do so follows, in the future a better procedure will be published here.
{{Code|Symplification of a polygon compatible with geometry package|<pre>
{{Code|Symplification of a polygon compatible with geometry package|<pre>
 
Ps = P;
n  = 1e6;
thrsd = 0.38;
while n>size (Ps,1)
  n  = size (Ps,1);
  ds = sqrt (sumsq (Ps(1:end,:) - Ps([2:end 1],:),2));
  Ps = Ps(ds>mean (ds)*(1-thrsd),:);
end
whos P Ps
</pre>}}
</pre>}}


657

edits

Navigation menu