簡體   English   中英

變槳偏航累積opengl

[英]Pitch Yaw Roll accumulation opengl

我正在嘗試為可視化相機實現超過360度的偏航角輥,例如在Maya,Blender,Unreal Engine,Unity等中。所有此應用程序都可以在gui中顯示超過360度的角度,並且沒有萬向節鎖定問題。

當前的psevdo代碼;

Quaternion rotation; //relative (local rotation)
Quaternion parentRotation;
    //it is psevdo code where we calculate delta angle that user generate on current frame by mouse
void SetDeltaWorldRotationFromUserInput(Quaternion value)
{
    SetWorldRotation(value);
}

void SetWorldRotation(Quaternion value)
{
    SetLocalRotation(parentQuaternion.inverted() * value); //get/set local rotation
}

void SetLocalRotation(Quaternion value)
{
    rotation = value; //this we save new local rotation but i want to save somehow more then 360 degree 
    auto eulersForGui = value.toEulers(); //it is current eulers but i want to accumulate and show in gui accumulate rotation. like currentRotation + delta or somehow

    auto deltaEulers = (value * rotation.inverted()).toEulers(); //i can get delta eulers but i can't add it to euelers and don't know what i need to do with this value

}

我在評論部分留下了指向您問題的鏈接。 但是,作為對您的問題的快速解答,我認為該網頁上的這句話應該為您指明正確的方向:

“旋轉序列可以用一系列四元數相乘來表示,產生一個生成的四元數,該四元數對組合的旋轉進行編碼。”

上面的引用可以引用多個四元數,每個四元數圍繞一個不同的軸旋轉以進行3D組合旋轉,或圍繞同一軸的多個旋轉,這些累積將累積為單個旋轉大於360度。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM