REAL SegComp::square_dist_demi_droite(Pt2dr pt) const { REAL a = abscisse(pt); REAL o2 = ElSquare(ordonnee(pt)); if (a < 0) return o2 + ElSquare(a); else return o2; }
void Ennemi::defRotation() { sf::Vector2f abscisse(1,0); float rotationDeg = se::Utils::radsToDeg(se::Utils::getOrientedAngle(speed,abscisse)); if(se::Utils::det(speed,abscisse)>0) rotationDeg*=-1; myEntity->setRotation(rotationDeg); myShadow->setRotation(rotationDeg); }
REAL SegComp::square_dist_seg(Pt2dr pt) const { REAL a = abscisse(pt); REAL o2 = ElSquare(ordonnee(pt)); if (a < 0) { return o2 + ElSquare(a); } else if (a < _a1) { return o2; } else { return o2 + ElSquare(a-_a1); } }