class car { // cars float h=30, w=100; // car dimensions // float h=15, w=30; // car dimensions // float h=30, w=70; // car dimensions color col=color(20,60,30,30); // color of car pt B=new pt(0,0), F=new pt(w,0); // front and back points (centers of disks) float speed = 1; // speed of car (user adjusted) float a=0.0; // angle of car orientation wrt I vector boolean picked = false; // true if car being dragged boolean pickedSpeed = false; // true if speed being adjusted car() {}; car (float px, float py, float pa, color pc) {B.x=px; B.y=py; a=pa; a=roll(a); col=pc; F.x=px+w; F.y=py; F.turnAround(B,-a);} // creation car clone () {return(new car (B.x,B.y,a,col));} // creation void setFrom (car C) {B.x=C.B.x; B.y=C.B.y; a=C.a; col=C.col; F.x=B.x+w; F.y=B.y; F.turnAround(B,-a); } // creation void paint() {pushMatrix(); translate(B.x,B.y); rotate(a); // paints car noStroke(); fill(col); ellipse(0,0,h,h); beginShape(); vertex(0,h/2); vertex(w,0); vertex(0,-h/2); endShape(CLOSE); popMatrix(); } boolean selected() {boolean pic = F.vecTo(mouse()).norm()