void ofTurtle::reset() { clear(); pos=start; bearing=ofVector(0,-1); bCompleted=bCrashed=false; }
void ofTurtle::setup(string filename) { map.loadImage(filename); int ppi=pixPerInch=map.width/48; ofPoint wheel(.25*ppi,(2+3/8)*ppi); ofPoint rWheel(1.125*ppi,1.875*ppi); setup(2*(map.width/12.),map.height-3*(map.height/12.), pixPerInch*5,7.25*pixPerInch); ofRectangle body(-3.25*ppi/2,-wheel.y/2,ppi*3.25,ppi*4.5); bdy.push_back(ofVector(body.x,body.y)); bdy.push_back(ofVector(body.x+body.width,body.y)); bdy.push_back(ofVector(body.x,body.y+body.height)); bdy.push_back(ofVector(body.x+body.width,body.y+body.height)); //bdy.push_back(ofVector(body.x+(body.width-rWheel.x)/2,body.y+body.height+rWheel.y)); //bdy.push_back(ofVector(body.x+(body.width+rWheel.x)/2,body.y+body.height+rWheel.y)); //ofRect(body.x+(body.width-ppi*1.375)/2+.125*ppi, body.y+body.height+.5*ppi, .875*ppi, 1.5*ppi); }
void ofTurtle::setup(int _x, int _y, int _w, int _h) { numLineStored=pixPerInch*16; start.x=pos.x=_x,start.y=pos.y=_y,w=_w,h=_h; whlHgt=h/2; whlWid=w/8; bearing=ofVector(0,-1); }
ofVector ofVector::operator-(ofVector A) { return ofVector(x-A.x,y-A.y,z-A.z); }
ofVector ofVector::operator+(ofVector A) { return ofVector(x+A.x, y+A.y, z+A.z); }
ofVector ofVector::operator/(double c) { return ofVector(x/c, y/c,z/c); }
ofVector ofVector::operator*(double c) { return ofVector(x*c, y*c,z*c); }
ofVector ofVector::operator^(ofVector B) { return ofVector(y*B.z-z*B.y,z*B.x-x*B.z,x*B.y-y*B.x); }
ofVector sqrt(ofVector k){ return ofVector(sqrt(k.x),sqrt(k.y),sqrt(k.z)); }
ofVector operator*(double c, ofVector B) { return ofVector(B*c); }
ofVector ofVector::ortho(){ return ofVector (y,-x); }
ofVector ofVector::unit(){ return ofVector(x/mag(), y/mag(),z/mag()); }
ofVector ofVector::operator-() { return ofVector(-x,-y,-z); }