0

GLKQuaternionsの奇妙な問題を理解しようとしています。クォータニオンの情報を出力しようとすると、毎回w=0の値になります。ただし、デバッガ領域では、-4.37114e-08がこの値に格納されていることが明確に示されています。理由がわかりません。私の印刷物の声明は言う:

NSLog(@"\n\nSLERP: Animation.Current:x:%f,y:%f,z:%f,w:%f and Animation.End:x:%f,y:%f,z:%f,w:%f", animation.Current.x, animation.Current.y, animation.Current.z, animation.Current.w, animation.End.x, animation.End.y, animation.End.z, animation.End.w);

私の構造体は

typedef struct{
    GLKQuaternion Start; //starting orientation
    GLKQuaternion End; //ending orientation
    GLKQuaternion Current; //current interpolated orientation
    float Elapsed; //time span in seconds for a slerp fraction between 0 and 1
    float Duration; //time span in seconds for a slerp fraction between 0 and 1
}Animation; //enables smooth 3D transitions

デバッガーは次のように表示されます。

ここに画像の説明を入力してください

同時にデバッガーでanimation.End.w=-4.37114e-08と述べている間は、animation.End.w=-4.37114e-08であることに注意してください。印刷ステートメントの直後にブレークポイントを設定しました。誰かがこれを引き起こす原因を知っていますか?wの変数に関する私の計算に干渉していると思います。

4

1 に答える 1

2

%f小数点以下6桁のみを出力します。

例として、%.9f小数点以下9桁まで出力するために使用します。明らかに、-4.37114 * 10^-08小数点以下6桁以上が必要になるため、NSLogのフォーマットを変更する必要があります。

于 2013-03-26T02:29:50.820 に答える