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


C++ EulerAngles::theta方法代码示例

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


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

示例1: aimAt

  bool GlareSensor_Impl::aimAt(const Point3d& target)
  {
    Point3d position = this->position();
    Vector3d vector = target - position;

    if (!vector.normalize()){
      return false;
    }

    Vector3d yAxis(0,1,0);
    Vector3d rotationAxis = yAxis.cross(vector);

    if (!rotationAxis.normalize()){
      return false;
    }

    double angle = getAngle(yAxis, vector);
    Transformation transformation = Transformation::rotation(rotationAxis, angle);
    EulerAngles eulerAngles = transformation.eulerAngles();

    this->setPsiRotationAroundXAxis(eulerAngles.psi());
    this->setThetaRotationAroundYAxis(eulerAngles.theta());
    this->setPhiRotationAroundZAxis(eulerAngles.phi());

    return true;
  }
开发者ID:Anto-F,项目名称:OpenStudio,代码行数:26,代码来源:GlareSensor.cpp

示例2: setTransformation

  bool GlareSensor_Impl::setTransformation(const openstudio::Transformation& transformation) 
  {
    Vector3d translation = transformation.translation();
    this->setPositionXCoordinate(translation.x());
    this->setPositionYCoordinate(translation.y());
    this->setPositionZCoordinate(translation.z());

    EulerAngles eulerAngles = transformation.eulerAngles();
    setPsiRotationAroundXAxis(radToDeg(eulerAngles.psi()));
    setThetaRotationAroundYAxis(radToDeg(eulerAngles.theta()));
    setPhiRotationAroundZAxis(radToDeg(eulerAngles.phi()));
    
    return true;  
  }
开发者ID:Anto-F,项目名称:OpenStudio,代码行数:14,代码来源:GlareSensor.cpp

示例3: setTransformation

  bool PlanarSurfaceGroup_Impl::setTransformation(const openstudio::Transformation& transformation) {

    EulerAngles eulerAngles = transformation.eulerAngles();
    if ((eulerAngles.psi() != 0) || (eulerAngles.theta() != 0)){
      return false;
    }

    double dORN = -radToDeg(eulerAngles.phi());
    this->setDirectionofRelativeNorth(dORN, false);

    Vector3d translation = transformation.translation();
    this->setXOrigin(translation.x(), false);
    this->setYOrigin(translation.y(), false);
    this->setZOrigin(translation.z(), false);
    this->emitChangeSignals();

    return true;
  }
开发者ID:ORNL-BTRIC,项目名称:OpenStudio,代码行数:18,代码来源:PlanarSurfaceGroup.cpp

示例4: setTransformation

  bool IlluminanceMap_Impl::setTransformation(const openstudio::Transformation& transformation) 
  {
    bool test;

    Vector3d translation = transformation.translation();
    this->setOriginXCoordinate(translation.x());
    this->setOriginYCoordinate(translation.y());
    this->setOriginZCoordinate(translation.z());

    EulerAngles eulerAngles = transformation.eulerAngles();
    test = this->setPsiRotationAroundXAxis(radToDeg(eulerAngles.psi()));
    OS_ASSERT(test);
    test = this->setThetaRotationAroundYAxis(radToDeg(eulerAngles.theta()));
    OS_ASSERT(test);
    test = this->setPhiRotationAroundZAxis(radToDeg(eulerAngles.phi()));
    OS_ASSERT(test);

    return true;
  }
开发者ID:MatthewSteen,项目名称:OpenStudio,代码行数:19,代码来源:IlluminanceMap.cpp

示例5: matrix

TEST_F(GeometryFixture, EulerAngles)
{
  Transformation transformation;
  EulerAngles angles = transformation.eulerAngles();
  EXPECT_EQ(0.0, angles.psi());
  EXPECT_EQ(0.0, angles.theta());
  EXPECT_EQ(0.0, angles.phi());

  angles = EulerAngles(0,0,0);
  transformation = Transformation::rotation(angles);
  Matrix rotationMatrix = transformation.rotationMatrix();
  ASSERT_EQ(static_cast<unsigned>(3), rotationMatrix.size1());
  ASSERT_EQ(static_cast<unsigned>(3), rotationMatrix.size2());
  EXPECT_EQ(1.0, rotationMatrix(0,0));
  EXPECT_EQ(0.0, rotationMatrix(0,1));
  EXPECT_EQ(0.0, rotationMatrix(0,2));
  EXPECT_EQ(0.0, rotationMatrix(1,0));
  EXPECT_EQ(1.0, rotationMatrix(1,1));
  EXPECT_EQ(0.0, rotationMatrix(1,2));
  EXPECT_EQ(0.0, rotationMatrix(2,0));
  EXPECT_EQ(0.0, rotationMatrix(2,1));
  EXPECT_EQ(1.0, rotationMatrix(2,2));

  transformation = Transformation::translation(Vector3d(1,1,1));
  angles = transformation.eulerAngles();
  EXPECT_EQ(0.0, angles.psi());
  EXPECT_EQ(0.0, angles.theta());
  EXPECT_EQ(0.0, angles.phi());

  transformation = Transformation::rotation(Vector3d(1,0,0), 1.0);
  angles = transformation.eulerAngles();
  EXPECT_EQ(1.0, angles.psi());
  EXPECT_EQ(0.0, angles.theta());
  EXPECT_EQ(0.0, angles.phi());

  angles = EulerAngles(1,0,0);
  transformation = Transformation::rotation(angles);
  rotationMatrix = transformation.rotationMatrix();
  ASSERT_EQ(static_cast<unsigned>(3), rotationMatrix.size1());
  ASSERT_EQ(static_cast<unsigned>(3), rotationMatrix.size2());
  EXPECT_NEAR(1.0, rotationMatrix(0,0), 0.0001);
  EXPECT_NEAR(0.0, rotationMatrix(0,1), 0.0001);
  EXPECT_NEAR(0.0, rotationMatrix(0,2), 0.0001);
  EXPECT_NEAR(0.0, rotationMatrix(1,0), 0.0001);
  EXPECT_NEAR(cos(1.0), rotationMatrix(1,1), 0.0001);
  EXPECT_NEAR(-sin(1.0), rotationMatrix(1,2), 0.0001);
  EXPECT_NEAR(0.0, rotationMatrix(2,0), 0.0001);
  EXPECT_NEAR(sin(1.0), rotationMatrix(2,1), 0.0001);
  EXPECT_NEAR(cos(1.0), rotationMatrix(2,2), 0.0001);

  transformation = Transformation::rotation(Vector3d(0,1,0), 1.0);
  angles = transformation.eulerAngles();
  EXPECT_EQ(0.0, angles.psi());
  EXPECT_EQ(1.0, angles.theta());
  EXPECT_EQ(0.0, angles.phi());

  angles = EulerAngles(0,1,0);
  transformation = Transformation::rotation(angles);
  rotationMatrix = transformation.rotationMatrix();
  ASSERT_EQ(static_cast<unsigned>(3), rotationMatrix.size1());
  ASSERT_EQ(static_cast<unsigned>(3), rotationMatrix.size2());
  EXPECT_NEAR(cos(1.0), rotationMatrix(0,0), 0.0001);
  EXPECT_NEAR(0.0, rotationMatrix(0,1), 0.0001);
  EXPECT_NEAR(sin(1.0), rotationMatrix(0,2), 0.0001);
  EXPECT_NEAR(0.0, rotationMatrix(1,0), 0.0001);
  EXPECT_NEAR(1.0, rotationMatrix(1,1), 0.0001);
  EXPECT_NEAR(0.0, rotationMatrix(1,2), 0.0001);
  EXPECT_NEAR(-sin(1.0), rotationMatrix(2,0), 0.0001);
  EXPECT_NEAR(0.0, rotationMatrix(2,1), 0.0001);
  EXPECT_NEAR(cos(1.0), rotationMatrix(2,2), 0.0001);

  transformation = Transformation::rotation(Vector3d(0,0,1), 1.0);
  angles = transformation.eulerAngles();
  EXPECT_EQ(0.0, angles.psi());
  EXPECT_EQ(0.0, angles.theta());
  EXPECT_EQ(1.0, angles.phi());

  angles = EulerAngles(0,0,1);
  transformation = Transformation::rotation(angles);
  rotationMatrix = transformation.rotationMatrix();
  ASSERT_EQ(static_cast<unsigned>(3), rotationMatrix.size1());
  ASSERT_EQ(static_cast<unsigned>(3), rotationMatrix.size2());
  EXPECT_NEAR(cos(1.0), rotationMatrix(0,0), 0.0001);
  EXPECT_NEAR(-sin(1.0), rotationMatrix(0,1), 0.0001);
  EXPECT_NEAR(0.0, rotationMatrix(0,2), 0.0001);
  EXPECT_NEAR(sin(1.0), rotationMatrix(1,0), 0.0001);
  EXPECT_NEAR(cos(1.0), rotationMatrix(1,1), 0.0001);
  EXPECT_NEAR(0.0, rotationMatrix(1,2), 0.0001);
  EXPECT_NEAR(0.0, rotationMatrix(2,0), 0.0001);
  EXPECT_NEAR(0.0, rotationMatrix(2,1), 0.0001);
  EXPECT_NEAR(1.0, rotationMatrix(2,2), 0.0001);

  Matrix matrix(4,4);
  matrix(0,0) = 0.5;
  matrix(0,1) = -0.1464;
  matrix(0,2) = 0.8536;
  matrix(1,0) = 0.5;
  matrix(1,1) = 0.8536;
  matrix(1,2) = -0.1464;
  matrix(2,0) = -0.7071;
//.........这里部分代码省略.........
开发者ID:MatthewSteen,项目名称:OpenStudio,代码行数:101,代码来源:Transformation_GTest.cpp


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