2017-02-14 10 views
-1

このコードから、私はsqrtに関するいくつかの問題があります。& cosはメソッドを解決できず、EPSILONはシンボルを解決できません。私はsinコサスのために数学ライブラリ& sqrtを追加する必要がありますか?はいの場合は、私は瓶をダウンロードするためのリンクを与えることができますか?問題はメソッドとシンボルを解決できません

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); 
+1

JAR?これはJavaですか?それらはMath.sqrt、Math.sin、Math.cosでなければなりません。 EPSILONはあなたによって二倍に定義されるべきです。ライブラリは必要ありません。 – duffymo

+0

コピーして貼り付けたコードには 'import static java.lang.Math.sqrt; '(他の関数でも同じですが、EPSILON定数でも同様です)と思われます。 –

+0

私は、静的java.lang.Math.sqrtをインポートしようとしました。 float omegaMagnitude = sqrt(axisX * axisX + axisY * axisY + axisZ * axisZ)です。赤で下線が引かれています。 EPSILONのために、それを二重として定義する方法は本当にわかりません。 – MdZain

答えて

0

追加のライブラリをダウンロードする必要はありません。 使用Math.sin(x), Math.cos(x) and Math.sqrt(x)またはsin(x), cos(x) and sqrt(x)と(それが存在する場合は、しかしラインpackage [...]下に)あなたのファイルの先頭に次のコードを配置:

// For Math.xxx() 
import java.lang.Math; 

// For xxx() 
import static java.lang.Math.sin; 
import static java.lang.Math.cos; 
import static java.lang.Math.sqrt; 

Eclipseを使用している場合は、単に(自動インポートを整理するCtrl + Shift + Oを押します他のIDEにも同様のショートカットが必要です)。

関連する問題