// This macro draws convex hulls using the "gift wrap" algorithm discribed at // http://www.cse.unsw.edu.au/~lambert/java/3d/hull.html drawConvexHull(false); macro "Blobs Demo" { run("Blobs (25K)"); setThreshold(125, 248); run("Analyze Particles...", "show=Nothing exclude clear record"); drawAllConvexHulls(); } macro "Draw Convex Hull" { drawConvexHull(false); } macro "Draw Animated Convex Hull" { drawConvexHull(true); } macro "Analyze Particles and Draw" { run("Analyze Particles...", "show=Nothing exclude clear record"); drawAllConvexHulls(); } function drawAllConvexHulls() { for (i=0; i0) {x2=x3; y2=y3; p2=p3;} p3 += 1; if (p3==n) p3 = 0; } while (p3!=p1); if (animate) {reset(); drawLine(x1,y1,x2,y2); snapshot();} else drawLine(x1,y1,x2,y2); p1 = p2; } while (p1!=pstart); updateDisplay(); } // find upper right point that is guaranteed to be on convex hull function findFirstPoint(xCoordinates, yCoordinates) { n = xCoordinates.length; smallestY = getHeight(); for (i=0; i250) delay = 250; if (delay<1) delay = 1; wait(delay); } // print(xCoordinates[6]+" "+yCoordinates[6]);