Esempio n. 1
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;
}
Esempio n. 2
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;
}
Esempio n. 3
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);
}
Esempio n. 4
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;
}
Esempio n. 5
0
point operator+(point& p1, point& p2){
    point sum = point(p1.getx()+p2.getx(),p1.gety()+p2.gety());
    return sum;
}
Esempio n. 6
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;
}