Beispiel #1
0
void ofTurtle::reset()
{
  clear();
  pos=start;
  bearing=ofVector(0,-1);
  bCompleted=bCrashed=false;
}
Beispiel #2
0
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);
}
Beispiel #3
0
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);
}
Beispiel #4
0
ofVector ofVector::operator-(ofVector A)
{
	return ofVector(x-A.x,y-A.y,z-A.z);
}
Beispiel #5
0
ofVector ofVector::operator+(ofVector A)
{
	return ofVector(x+A.x, y+A.y, z+A.z);
}
Beispiel #6
0
ofVector ofVector::operator/(double c)
{
	return ofVector(x/c, y/c,z/c);
}
Beispiel #7
0
ofVector ofVector::operator*(double c)
{
	return ofVector(x*c, y*c,z*c);
}
Beispiel #8
0
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);
}
Beispiel #9
0
ofVector sqrt(ofVector k){
	return ofVector(sqrt(k.x),sqrt(k.y),sqrt(k.z));
}
Beispiel #10
0
ofVector operator*(double c, ofVector B)
{
	return ofVector(B*c);
}
Beispiel #11
0
ofVector ofVector::ortho(){
	return ofVector (y,-x);
}
Beispiel #12
0
ofVector ofVector::unit(){
	return ofVector(x/mag(), y/mag(),z/mag());
}
Beispiel #13
0
ofVector ofVector::operator-()
{
	return ofVector(-x,-y,-z);
}