// ---------------------------------- // for sorting paths class Path { int num; boolean flipped; Path(int _num, boolean _flipped) { num=_num; _flipped=flipped; } } // SVG and Path Planning Code void readSVGFile(String filename) { if(printToConsole)println("initializing geomerative library..."); RG.init(this); RG.ignoreStyles(true); //RG.setPolygonizer(RG.ADAPTATIVE); RG.setPolygonizer(RG.UNIFORMLENGTH); RCommand.setSegmentLength(SVGSEGMENTLENGTH*PPI); grp = RG.loadShape(filename); //grp = RG.loadShape("treemesh.svg"); //grp = RG.loadShape("exploded_pocket_knife_simplified.svg"); //grp = RG.loadShape("/Users/rtwomey/Documents/exploded_pocket_knife.svg"); //grp = RG.loadShape("/Users/rtwomey/Documents/eye nerves outline.svg"); //grp = RG.loadShape("/Users/rtwomey/Documents/sign of the snake.svg"); //grp = RG.loadShape("cal39.svg"); //grp = RG.loadShape("/Users/rtwomey/Documents/blood_storage_container_and_methods_fig3.svg"); //grp = RG.loadShape("slit lamp diagram.svg"); //grp = RG.loadShape("/Users/rtwomey/Documents/rocking_horse.svg"); //grp = RG.loadShape("/Users/rtwomey/Documents/schechner_the_fan.svg"); //grp = RG.loadShape("/Users/rtwomey/Documents/bedroom_laurel_hatched_simplified.svg"); //grp = RG.loadShape("/Users/rtwomey/Documents/svgs/threshold_20_blur_hatch.svg"); //grp = RG.loadShape("/Users/rtwomey/Documents/ankle_brace.svg"); //grp = RG.loadShape("box.svg"); grp.centerIn(g, 0, 0, 0); grpW = grp.getWidth(); grpH = grp.getHeight(); grpX = grp.getX(); grpY = grp.getY(); if(printToConsole) { print("width X height: "+grpW+" "+grpH); println(" (inches "+(grpW/PPI)+" "+(grpH/PPI)+")"); println("on screen scale: "+onScreenScale); println("grpX,Y "+grpX+" "+grpY); } pointPaths = grp.getPointsInPaths(); if(printToConsole) println("image has "+pointPaths.length+" paths"); paths = new Path[pointPaths.length]; for (int i=0;i 0) { pathUsed[testindex]=true; i=testindex; flipped=testflipped; count++; if (count>=pointPaths.length) done=true; } else { done=true; } } if(printToConsole) println("done sorting."); } // display the sorted plotting path on screen void drawSortedPointPaths() { float xstart, ystart, xend, yend; float lastx=0, lasty=0; for (int i=0; i