示例#1
0
void Path::draw(){
  ofSetColor(color);
  std::list<Position>::iterator i;
  i = p.begin();
  if(i == p.end()) return;
  int counter = 0;
  float prevX = i->x;
  float prevY = i->y;
  while(1){
    i++;
    if(i == p.end()) return;
    if(counter % 100 == 0){
      ofLine(xForDraw(prevX), yForDraw(prevY), xForDraw(i->x), yForDraw(i->y));
      prevX = i->x;
      prevY = i->y;
    }
    counter++;
  }
}
示例#2
0
void Ball::draw(){
  ofSetColor(color);
  ofFill();
  ofCircle(xForDraw() ,yForDraw(), 30);
  
  ofLine(xForDraw() - cos(theta) * 1200, yForDraw() - sin(theta) * 1200, xForDraw() + cos(theta) * 1200, yForDraw() + sin(theta) * 1200);
  ofLine(xForDraw() - sin(theta) * 1200, yForDraw() + cos(theta) * 1200, xForDraw() + sin(theta) * 1200, yForDraw() - cos(theta) * 1200);
  
  arrow.xFrom = xForDraw();
  arrow.yFrom = yForDraw();
  arrow.xTo = xForDraw() + cos(theta) * 60;
  arrow.yTo = yForDraw() + sin(theta) * 60;
  arrow.draw();
  
  
}