De ce code, j'ai un problème avec la méthode sqrt, sin & car je n'arrive pas à résoudre le problème et l'EPSILON ne peut pas résoudre le symbole. Ai-je besoin d'ajouter dans la bibliothèque de maths pour le sin cos & sqrt? Si oui pouvez-vous me donner le lien pour télécharger le pot?Problème avec la méthode et le symbole qui ne peuvent pas être résolus
float omegaMagnitude = sqrt(axisX*axisX + axisY*axisY + axisZ*axisZ);
// Normalize the rotation vector if it's big enough to get the axis
// (that is, EPSILON should represent your maximum allowable margin of error)
if (omegaMagnitude > EPSILON) {
axisX /= omegaMagnitude;
axisY /= omegaMagnitude;
axisZ /= omegaMagnitude;
}
// Integrate around this axis with the angular speed by the timestep
// in order to get a delta rotation from this sample over the timestep
// We will convert this axis-angle representation of the delta rotation
// into a quaternion before turning it into the rotation matrix.
float thetaOverTwo = omegaMagnitude * dT/2.0f;
float sinThetaOverTwo = sin(thetaOverTwo);
float cosThetaOverTwo = cos(thetaOverTwo);
JAR? C'est Java? Ceux-ci devraient être Math.sqrt, Math.sin et Math.cos. EPSILON devrait être défini comme un double par vous. Aucune bibliothèque nécessaire. – duffymo
Je soupçonne que le code que vous avez copié et collé a 'import static java.lang.Math.sqrt;' (et même pour les autres fonctions, et similaire pour la constante EPSILON). –
J'ai essayé d'utiliser l'import static java.lang.Math.sqrt; mais le flotteur omegaMagnitude = sqrt (axeX * axeX + axeY * axeY + axeZ * axeZ); est souligné en rouge. Pour l'EPSILON je ne sais pas trop comment le définir comme double. – MdZain