-1
從這段代碼我有幾個問題與sqrt,sin & COS不能解決方法和EPSILON無法解析符號。我是否需要在數學庫中添加sin cos & sqrt?如果是,你可以給我鏈接下載jar嗎?問題與不能解決方法和符號
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?這是Java?這些應該是Math.sqrt,Math.sin和Math.cos。 EPSILON應該被定義爲你的雙倍。沒有圖書館需要。 – duffymo
我懷疑你複製和粘貼的代碼有'import static java.lang.Math.sqrt;'(對於其他函數以及EPSILON常量類似)。 –
我已經嘗試使用導入靜態java.lang.Math.sqrt;但float omegaMagnitude = sqrt(axisX * axisX + axisY * axisY + axisZ * axisZ);以紅色加下劃線。對於EPSILON im不知道如何將其定義爲double。 – MdZain