size(8cm,10cm,false); import math; bool counterclockwise(path g) { // Return "true" if "g" (SIMPLE CURVE i.e. NON CROSSED) is counterclockwise // Retounre "true" si "g" (NON CROISÉ) est dans le sens contraire des aiguilles d'une montre return (windingnumber(g,inside(g)) > 0); } path counterclockdirected(path g) { if (counterclockwise(g)) return g; else return reverse(g); } guide randompath(int pt, real u=1) { guide rpath; pair ptl; for(int i=1; i<=pt; ++i) { pair ptt=ptl+u*(rand()/randMax-0.5,rand()/randMax-0.5); rpath=rpath..ptt; ptl=ptt; } return rpath; } guide p=randompath(50,4)..cycle; draw(counterclockdirected(reverse(p)),Arrow(Relative(0.005)), BeginBar); draw(counterclockdirected(p),Arrow(position=Relative(.005),FillDraw(red)), BeginBar); label("Attention - Caution",(xpart(.5(max(p)+min(p))),ypart(min(p))));