void drawEm() { String pdfname=""; background(0); // clear previous crap if (! applet) { noStroke(); rectMode(CENTER); fill(255,255,0); rect(button_pdf.x, button_pdf.y, 8,8); } if (record == true) { pdfname = "pdf/stereotomic-" + millis() + ".pdf"; beginRecord(PDF, pdfname); } noFill(); // draw base lines plan_bline.drawLine(); el_bline.drawLine(); // fold line fold.drawLine(); // construction lines // connect perspective points stroke(50); if (record) { stroke(200); } line(p1.x, p1.z, p1.x, p1.y); line(p2.x, p2.z, p2.x, p2.y); line(p3.x, p3.z, p3.x, p3.y); line(p4.x, p4.z, p4.x, p4.y); // stereotomic perspective lines plan_p1b2.drawLine(); plan_p1t2.drawLine(); plan_p2b3.drawLine(); plan_p2t3.drawLine(); plan_p3b1.drawLine(); plan_p3t1.drawLine(); plan_p4b2.drawLine(); plan_p4t2.drawLine(); el_p1t2.drawLine(); el_p2t3.drawLine(); el_p3t1.drawLine(); el_p4t2.drawLine(); // connect points across fold stroke(50); if (record) { stroke(200); } line(b1.x, el_bline.height, b1.x, b1.y); line(b2.x, el_bline.height, b2.x, b2.y); line(b3.x, el_bline.height, b3.x, b3.y); line(b4.x, el_bline.height, b4.x, b4.y); line(t1.x, t1.z, t1.x, t1.y); line(t2.x, t2.z, t2.x, t2.y); line(t3.x, t3.z, t3.x, t3.y); line(t4.x, t4.z, t4.x, t4.y); // solid lines stroke(255); if (record) { stroke(0); } // base in plan beginShape(); vertex(b1.x, b1.y); vertex(b2.x, b2.y); vertex(b3.x, b3.y); vertex(b4.x, b4.y); vertex(b1.x, b1.y); endShape(); // base in elevation beginShape(); vertex(b1.x, el_bline.height); vertex(b2.x, el_bline.height); vertex(b3.x, el_bline.height); vertex(b4.x, el_bline.height); vertex(b1.x, el_bline.height); endShape(); // top in plan beginShape(); vertex(t1.x, t1.y); vertex(t2.x, t2.y); vertex(t3.x, t3.y); vertex(t4.x, t4.y); vertex(t1.x, t1.y); endShape(); //top in elevation beginShape(); vertex(t1.x, t1.z); vertex(t2.x, t2.z); vertex(t3.x, t3.z); vertex(t4.x, t4.z); vertex(t1.x, t1.z); endShape(); line(b1.x,el_bline.height, t1.x, t1.z); line(b1.x, b1.y, t1.x, t1.y); line(b2.x, b2.y, t2.x, t2.y); line(b2.x, el_bline.height, t2.x, t2.z); line(b3.x, b3.y, t3.x, t3.y); line(b3.x, el_bline.height, t3.x, t3.z); line(b4.x, el_bline.height, t4.x, t4.z); line(b4.x, b4.y, t4.x, t4.y); // unfolded stroke(150,200,0); beginShape(); vertex(b2.x, b2.y); vertex(t2b.x, t2b.y); vertex(t3a.x, t3a.y); vertex(b3.x, b3.y); vertex(t3b.x, t3b.y); vertex(t4a.x, t4a.y); vertex(b4.x, b4.y); vertex(t4b.x, t4b.y); vertex(t1a.x, t1a.y); vertex(b1.x, b1.y); vertex(t1b.x, t1b.y); vertex(t2a.x, t2a.y); vertex(b2.x, b2.y); endShape(); // lid beginShape(); vertex(t1c.x, t1c.y); vertex(t2c.x, t2c.y); vertex(t3c.x, t3c.y); vertex(t4c.x, t4c.y); vertex(t1c.x, t1c.y); endShape(); if (record == true) { endRecord(); link(pdfname, "_blank"); record = false; } // draw control points noStroke(); rectMode(CENTER); // corner points fill(0,255,0); b1.drawPoint(); b2.drawPoint(); b3.drawPoint(); b4.drawPoint(); fill(255,255,0); t1.drawPoint(); t2.drawPoint(); t3.drawPoint(); t4.drawPoint(); // vanishing points p1.drawPoint(); p2.drawPoint(); p3.drawPoint(); p4.drawPoint(); // draw text to ID last control point fill(255,100,0); textFont(font); String newtxt = last.txtID + "\n(" + (int)last.x + "," + (int)(fold.height-last.y) + "," + (int)(el_bline.height - last.z) + ")"; //text(newtxt, last.x+47, ((last.focus==PLAN)?last.y:last.z)+17, 90, 30); text(newtxt, 50, 20, 90, 30); }