Example #1
0
// Processes mouse movements for skeleton manipulation
void trackMouse(int x, int y)
{
    if(mode == 2 && selected >= joints.size())
    {
        point *s = &xydpoints.at(selected - joints.size());
        if(RM)
        {
            double shift = (clickpos.gety() - y)/50.;
            *s = point(s->getx(), s->gety(), clickpos.getz()+shift);
        }
        else
        {
            *s = point(x, y, s->getz());
        }
        setTargets();
    }
    else if(mode == 1)
    {
        if(LM && selected >= 0 && selected <= joints.size())
        {
            double shift = clickpos.gety() - y;
            joints.at(selected)->settheta(clickpos.getz() + shift);
        }
    }
}
Example #2
0
float point::calctempdist(point p) {
  float dist = ((p.getx()) - (this->x) )*( (p.getx()) - (this->x)) ;
  dist += (p.gety()-(this->y))*(p.gety()-(this->y));
  dist += (p.gett()-(this->t))*(p.gett()-(this->t));
  dist= sqrt(dist);
  return dist;
}
Example #3
0
bool tour(int board[8][8],point posNew,int step){
    int x = posNew.getx();
    int y = posNew.gety();
    
    if (step==64) {
        return true;
    }
    bool result;
    for (int k=0; k<8; k++) {
        point p = move(x,y,k+1);
        int x1,y1;
        x1 = p.getx();
        y1 = p.gety();
        if (x1<8 && x1>=0 && y1<8 && y1>=0 && board[x1][y1]==-1) {
            board[x1][y1] = step;
            result = tour(board, p, step+1);
            if (result) {
                return true;
            }else{
                board[x1][y1]=-1;
            }
        }
    }
    return false;
}
Example #4
0
// Convert mouse coordinates + depth to world coordinates
point mouseToObj(point xyd)
{
    int mx = xyd.getx();
    int my = xyd.gety();
    double depth = xyd.getz();

    float clipx = 2.0*mx/win_width - 1;
    float clipy = 2.0*(win_height - my)/win_height - 1;
    glm::vec4 clip1 = projection*viewT*glm::vec4(0, 0, depth, 1);
    glm::vec4 clip(clipx, clipy, clip1.z/clip1.w, 1);

    glm::vec4 world = glm::inverse(projection*viewT*viewR)*clip;

    return point(world.x/world.w, world.y/world.w, world.z/world.w);
}
Example #5
0
//************************************
// Method:    writeSomethingAt- writes a string to the screen at the requested place.
// FullName:   UIs::UI::writeSomethingAt
// Access:    protected
// Returns:   void
// Qualifier: const
// Parameter: const char* str - text to write.
// Parameter: const point& place - the point at which to write.
//************************************
void UIs::UI::writeSomethingAt(const char * str,const point & place ) 
{
	gotoxy(place.getx(),place.gety());
	cout<<str;
}
Example #6
0
point operator+(point& p1, point& p2){
    point sum = point(p1.getx()+p2.getx(),p1.gety()+p2.gety());
    return sum;
}
Example #7
0
float point::calcdist(point p) {
  float dist = ( ((p.getx()) - (this->x) )*( (p.getx()) - (this->x)) ) + ( (p.gety()-(this->y))*(p.gety()-(this->y)) );
  dist= sqrt(dist);
  return dist;
}