void update(point changeCell) { double dCell[] = {changeCell.getX(),changeCell.getY(),changeCell.getZ()}; if(dCell[0] <= length && dCell[1] <= width && dCell[2] <= height) { //find the node in the k-tree with the same location Node *getN = mesh.search(mesh.getRoot(),dCell); //update everything else getN->cell=changeCell; } }
/*cubeCol* joueur::getCube() { return &collision; }*/ void joueur::miseAjour(point newPosition, uint16_t newAngleX, uint16_t newAngleY, uint8_t newGaz, uint8_t newAxeX, uint8_t newAxeY, float newVitesse) { if(newPosition.getX() > -251 && newPosition.getX() < 251 && newPosition.getY() > -251 && newPosition.getY() < 251 && newPosition.getZ() > -251 && newPosition.getZ() < 251) { position = newPosition; } if(newAngleX < 361) { angleX = newAngleX; } if(newAngleY < 361) { angleY = newAngleY; } if(newGaz == 0 || newGaz == 1) { gaz = newGaz; } if(newAxeX == 0 || newAxeX == 1 || newAxeX == 2 ) { axeX = newAxeX; } if(newAxeY == 0 || newAxeY == 1 || newAxeY == 2 ) { axeY = newAxeY; } if(newVitesse >= 0 && newVitesse <= vitesseMax) { vitesse = newVitesse; } }
double joueur::distance(point a) { double distanceXZ = sqrt(double(a.getX()*a.getX()) + double(a.getZ()*a.getZ())); return sqrt(distanceXZ + double(a.getY() * a.getY())); }