2017-02-23 5 views
0

私の試験方法は以下の通りです:固有:: Affine3dローテーション予想外の結果で

TEST_METHOD(RotationTest1) 
    { 
     std::stringstream log; 
     Eigen::Affine3d t(
      Eigen::AngleAxisd(M_PI/4, Eigen::Vector3d::UnitZ())* 
      Eigen::AngleAxisd(M_PI/8, Eigen::Vector3d::UnitY()) 
      ); 
     log << "Expected:\n" << t.rotation(); 

     Eigen::Affine3d act; 
     act = Eigen::AngleAxisd(M_PI/4, Eigen::Vector3d::UnitZ())* 
      Eigen::AngleAxisd(M_PI/8, Eigen::Vector3d::UnitY()) * act; 
     //act.prerotate(Eigen::AngleAxisd(M_PI/8, Eigen::Vector3d::UnitY())); 
     //act.prerotate(Eigen::AngleAxisd(M_PI/4, Eigen::Vector3d::UnitZ())); 
     log << "\nActual:\n" << act.rotation(); 
     Logger::WriteMessage(log.str().c_str()); 
     Assert::IsTrue(t.rotation().isApprox(act.rotation())); 
    } 

これは、次の一貫性のない出力生産:

Expected: 
0.653281 -0.707107 0.270598 
0.653281 0.707107 0.270598 
-0.382683   0 0.92388 
Actual: 
-0.756394 0.645492 -0.10587 
-0.324051 -0.510375 -0.79656 
-0.568206 -0.568206 0.595217 

を誰かが、私には上記の動作をしてください説明できますか?

答えて

0

他の変換を試みる前に、変換をアイデンティティに設定しませんでした。それを修正するには、デフォルトの構文の後に行を追加します。

Eigen::Affine3d act; 
act.setIdentity(); 

するか、単位行列で構築:

Eigen::Affine3d act(Eigen::Affine3d::Identity()); 
+1

それとも単に製品チェーンの右にある行為のインスタンスを削除します。 – ggael

関連する問題