|
|
|
Figure 0001: fig0010.asy (Compiled with Asymptote version 2.14svn-r5318) |
import hull_pi;
import stats;
size(10cm);
pair[] cloud;
int nbpt=200;
// Generate random points.
for (int i=0; i < nbpt; ++i)
cloud.push((10*unitrand(),10*unitrand()));
// Nodes of the hull (here convex hull);
/* View the definition of pair[] hull(pair[],real,real,real,real,int) */
pair[] hull=hull(cloud);
/* View the definition of path polygon(pair[]) */
filldraw(polygon(hull),lightgrey);
dot(cloud,red);
|
|
|
Figure 0002: fig0020.asy (Compiled with Asymptote version 2.14svn-r5318) |
import hull_pi;
import stats;
size(10cm);
pair[] cloud;
int nbpt=200;
// Generate random points.
for (int i=0; i < nbpt; ++i)
cloud.push((10*unitrand(),10*unitrand()));
////////// GREY PART: angleMin=90 //////////
pair[] hull=hull(cloud,depthMin=0,depthMax=infinity,angleMin=90,angleMax=360);
filldraw(polygon(hull),lightgrey);
////////// YELLOW PART: angleMin=45 //////////
pair[] hull=hull(cloud,depthMin=0,depthMax=infinity,angleMin=45,angleMax=360);
filldraw(polygon(hull),lightyellow);
////////// BLUE PART: angleMin=0 //////////
pair[] hull=hull(cloud,depthMin=0,depthMax=infinity,angleMin=0,angleMax=360);
filldraw(polygon(hull),lightblue);
dot(cloud,red);
|
|
|
Figure 0003: fig0030.asy (Compiled with Asymptote version 2.14svn-r5318) |
import hull_pi;
import stats;
size(10cm);
pair[] cloud;
int nbpt=200;
// Generate random points.
for (int i=0; i < nbpt; ++i)
cloud.push((10*unitrand(),10*unitrand()));
////////// GREY PART: depthMax=1 //////////
pair[] hull=hull(cloud,depthMin=0,depthMax=1,angleMin=0,angleMax=360);
filldraw(polygon(hull),lightgrey);
////////// YELLOW PART: depthMax=2 //////////
pair[] hull=hull(cloud,depthMin=0,depthMax=2,angleMin=0,angleMax=360);
filldraw(polygon(hull),lightyellow);
////////// BLUE PART: depthMax=3 //////////
pair[] hull=hull(cloud,depthMin=0,depthMax=3,angleMin=0,angleMax=360);
filldraw(polygon(hull),lightblue);
dot(cloud,red);
|
|
|
Figure 0004: fig0040.asy (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));
Dernière modification/Last modified: Sun Jun 26 23:25:36 CEST 2011
Philippe Ivaldi