当前位置: 首页>>代码示例>>C++>>正文


C++ Quaternion::AsEulerYawPitchRoll方法代码示例

本文整理汇总了C++中Quaternion::AsEulerYawPitchRoll方法的典型用法代码示例。如果您正苦于以下问题:C++ Quaternion::AsEulerYawPitchRoll方法的具体用法?C++ Quaternion::AsEulerYawPitchRoll怎么用?C++ Quaternion::AsEulerYawPitchRoll使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Quaternion的用法示例。


在下文中一共展示了Quaternion::AsEulerYawPitchRoll方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: DumpBSpline

void DumpBSpline(NiBSplineCompTransformInterpolatorRef spline, string target)
{
   float start = spline->GetStartTime();
   float stop = spline->GetStopTime();

   int nframes = int((stop-start) / FramesIncrement);

   Ref<NiBSplineData > data = spline->GetSplineData();
   Ref<NiBSplineBasisData > basis = spline->GetBasisData();
   int nctrl = basis->GetNumControlPoints();

   cout.setf(ios::fixed, ios::floatfield);
   cout << setprecision(3); // << setiosflags(ios_base::showpos);

   if (dumpControl)
   {
      vector<short > control = data->GetShortControlPoints();
      cout << "Control data for " << target << endl
           << "Control Pt: " << control.size() << endl;
      int j=0;
      cout << "0" << '\t';
      for (int i=0, n=control.size(); i<n; ++i, ++j) {
         //cout << float(control[i]) / float (32767) << '\t';
         cout << i << '\t' << control[i] << endl;
      }
      cout << endl;

      return;
   }

   {
      vector<Vector3> control = spline->GetTranslateControlData();
      if (!control.empty()) {

         float mult = spline->GetTranslateMultiplier();
         float bias = spline->GetTranslateBias();

         cout << "Translation data for " << target << endl
            << "Control Pt: " << control.size() << endl
            << "Mult: " << mult << endl
            << "Bias: " << bias << endl
            << endl ;

         for (int i=0, n=control.size(); i<n; ++i){
            Vector3 xyz = control[i];
            cout << i << "\t[" << xyz.x << ",\t" << xyz.y << ",\t" << xyz.z << "]" << endl;
         }

         cout << endl;

         int npoints = control.size() * 2 + 1;
         vector< Key<Vector3> > keys = spline->SampleTranslateKeys(npoints, 3);
         for (int i=0, n=keys.size(); i<n; ++i){
            Vector3 xyz = keys[i].data;
            cout << i << "\t[" << xyz.x << ",\t" << xyz.y << ",\t" << xyz.z << "]" << endl;
         }
         cout << endl;
      }
   }

   {
      vector<Quaternion> control = spline->GetQuatRotateControlData();
      if (!control.empty()) {

         float mult = spline->GetRotationMultiplier();
         float bias = spline->GetRotationBias();

         cout << "Quaternion rotation data for " << target << endl
              << "Control Pt: " << control.size() << endl
              << "Mult: " << mult << endl
              << "Bias: " << bias << endl
              << endl ;

         for (int i=0, n=control.size(), j=1; i<n; ++i, ++j){
            Quaternion q = control[i];
            Float3 ypr = q.AsEulerYawPitchRoll();
               cout << i << "\t<" << q.w << ",\t" << q.x << ",\t" << q.y << ",\t" << q.z << ">"
                  << "\t[" << TODEG(ypr[0]) << ",\t" << TODEG(ypr[1]) << ",\t" << TODEG(ypr[2]) << "]" 
                  << endl;
            if (j==nctrl)
            {
               cout << endl;
               j = 0;
            }
         }

         cout << endl;

         int npoints = control.size() * 2 + 1;
         vector< Key<Quaternion> > keys = spline->SampleQuatRotateKeys(npoints, 3);
         for (int i=0, n=keys.size(); i<n; ++i){
            Quaternion q = keys[i].data;
            Float3 ypr = q.AsEulerYawPitchRoll();
            cout << i << "\t<" << q.w << ",\t" << q.x << ",\t" << q.y << ",\t" << q.z << ">"
               << "\t[" << TODEG(ypr[0]) << ",\t" << TODEG(ypr[1]) << ",\t" << TODEG(ypr[2]) << "]" 
               << endl;
         }
         cout << endl;
      }
   }
//.........这里部分代码省略.........
开发者ID:figment,项目名称:nifcmd,代码行数:101,代码来源:DumpBSplines.cpp


注:本文中的Quaternion::AsEulerYawPitchRoll方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。