#include "reflection_tessellation.jsx" #include "../omino_adobe_script_suite/src/shared/ominoDialogMaker.jsx" var gLastReflectionRadials; function mainxx1() { var omd = newOminoDialog("Radial Reflections"); omd.boxedText(5,"This Illustrator script tesselates radial lines 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("Radius","radius",600); omd.number("Spokes","spokes",10); omd.set(gLastReflectionRadials); var r = omd.run(); if(r != null) { gLastReflectionRadials = r; var t = tNew(); // lay down the point mesh. tAddPoint(t,0,0); var pi = 3.14159265358979323846264338327950288; for(var j = 0; j < r.spokes; j++) { var a = 2 * pi * j / r.spokes; var x = r.radius * Math.cos(a); var y = r.radius * Math.sin(a); tAddPoint(t,x,y); } // work on a new layer of the current doc. var doc = documents[0]; var layer = doc.layers.add(); layer.name = "tessellated_rectangles"; // center the tessellation var docCx = doc.width / 2; var docCy = doc.height / 2; tCenterOnto(t,docCx,docCy); // lay down the wedges for(var j = 0; j < r.spokes; j++) { var k = (j + 1) % r.spokes; tAddPoly(t,[0,j + 1,k+1]); } var po = t.polys[0]; // seed the center and draw if(r.drawImages) { var g = layer.groupItems.add(); g.name = "images"; var pa = tNewPatch(po.centerX,po.centerY,0,0); pa.scale = r.scale; po.pa = pa; // stash the patch in the poly tDrawKTessellation(g,t,r.f,po); } // draw the edges if(r.drawEdges) { var g = layer.groupItems.add(); g.name = "edges"; tDrawAllEdges(g,t); } // draw the center one tDrawPoly(layer,po,1,0,0,.3).name = "center_poly"; } } mainxx1();