#include "reflection_tessellation.jsx" #include "../omino_adobe_script_suite/src/shared/ominoDialogMaker.jsx" var gLastReflectionRectangles; function mainRefRects() { var omd = newOminoDialog("Circular Gauge"); omd.boxedText(5,"This Illustrator script tesselates rectangles with a reflected image."); omd.separator(); omd.checkbox("Draw Images","drawImages",false,"draw"); omd.openFile("Image","f",""); omd.number("Scale","scale",1.0); omd.checkbox("Draw Edges","drawEdges",true,"draw"); omd.number("Cell Size X","cellSizeX",100); omd.number("Y","cellSizeY",100); omd.number("Variation X","variationX",0); omd.number("Y","variationY",0); omd.number("Zigzag X","zigzagX",0); omd.number("Cells Across","cellsAcross",7); omd.number("Down","cellsDown",7); omd.set(gLastReflectionRectangles); var r = omd.run(); if(r != null) { gLastReflectionRectangles = r; var t = tNew(); // lay down the point mesh. for(var j = 0; j <= r.cellsDown; j++) { var y = 0 + j * r.cellSizeY; y += Math.floor(j / 2) * r.variationY; for(var i = 0; i <= r.cellsAcross; i++) { var x = 0 + i * r.cellSizeX; x += Math.floor(i / 2) * r.variationX; x += (j % 2) * r.zigzagX; tAddPoint(t,x,y); } } // lay down the rectangles for(var j = 0; j < r.cellsDown; j++) { var b = r.cellsAcross + 1; var ix = b * j; for(var i = 0; i < r.cellsAcross; i++) { tAddPoly(t,[t.points[ix + i],t.points[ix + i + 1],t.points[ix + i + b +1],t.points[ix + i + b]]); } } tDrawTessellationImagesAndEdges(t,"tessellated_rectanges",r.drawImages,r.drawEdges,r.f,r.scale); } } mainRefRects();