06 Nov 2007

Unofficial package hull_pi.asy – fig0040

Figure 0004
(Compiled with Asymptote version 2.14svn-r5318)
    
import hull_pi;
import stats;
size(10cm);

pair[] cloud;
int nbpt=15;
int depthMax=3;

// Generate random points.
for (int i=0; i < nbpt; ++i)
  cloud.push((10*unitrand(),10*unitrand()));

////////// WHITE PART: pivot automaticly computed //////////
pair[] hull=hull(cloud,depthMin=0,depthMax=depthMax,angleMin=0,angleMax=360);
draw(polygon(hull),2mm+white);

// ////////// RED PART: pivot=1 //////////
pair[] hull=hull(cloud,depthMin=0,depthMax=depthMax,angleMin=0,angleMax=360,1);
draw(polygon(hull),1mm+red);

// ////////// BLUE PART: pivot=3 //////////
pair[] hull=hull(cloud,depthMin=0,depthMax=depthMax,angleMin=0,angleMax=360,3);
draw(polygon(hull),bp+blue);

dot(cloud,yellow);
shipout(bbox(3mm,Fill));

Étiquettes :