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


C++ EulerAngles类代码示例

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


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

示例1: TEST

TEST( Transform, planeTransformation )
{
  // construct a transformation we'll use for testing
   Transform trans;
   Matrix transformMtx;
   {
      Matrix m1, m2;
      EulerAngles angles;
      angles.set( FastFloat::fromFloat( 45.0f ), FastFloat::fromFloat( 60.0f ), FastFloat::fromFloat( -10.0f ) );
      m1.setTranslation( Vector( 1, 2, 3 ) );
      m2.setRotation( angles );
      transformMtx.setMul( m2, m1 );

      trans.set( transformMtx );
   }

   // create a test plane
   Plane testPlane;
   testPlane.set( Float_1, Float_0, Float_0, FastFloat::fromFloat( 10.0f ) );

   // transform the plane
   Plane tamyTransformedPlane;
   trans.transform( testPlane, tamyTransformedPlane );

   // let DX help us generate a transformed plane we can compare our results against
   D3DXPLANE dxTransformedPlane;
   D3DXMATRIX dxMtx = ( const D3DXMATRIX& )transformMtx;
   D3DXMatrixInverse( &dxMtx, NULL, &dxMtx );
   D3DXMatrixTranspose( &dxMtx, &dxMtx );
   D3DXPlaneTransform( &dxTransformedPlane, ( const D3DXPLANE* )&testPlane, &dxMtx );

   COMPARE_PLANE( dxTransformedPlane, tamyTransformedPlane );
}
开发者ID:dabroz,项目名称:Tamy,代码行数:33,代码来源:TransformTests.cpp

示例2: reflectOrientation

/// \param angles The orientation (unit) vector that you want to reflect
/// \return Euler angles that are reflected about the slope of the plane.
EulerAngles Plane::reflectOrientation(const EulerAngles& angles) const
{
  EulerAngles out;
  Vector3 look, up, right;  
  RotationMatrix rotMat;
    
  // get look and up vector from euler angles
  rotMat.setup(angles); 
  look = rotMat.objectToInertial(Vector3(0.0f,0.0f,1.0f));
  up = rotMat.objectToInertial(Vector3(0.0f,1.0f,0.0f));

  // reflect the look and up vectors over the plane
  look = reflectOrientation(look);
  up = -reflectOrientation(up); 
  
  // calculate right vector
  right = Vector3::crossProduct( up, look);
  right.normalize();
    
  // create a rotation matrix from right, up, and look
  rotMat.m11 = right.x; rotMat.m12 = right.y; rotMat.m13 = right.z;
  rotMat.m21 = up.x; rotMat.m22 = up.y; rotMat.m23 = up.z;
  rotMat.m31 = look.x; rotMat.m32 = look.y; rotMat.m33 = look.z;
  
  // calculate new euler angles from the matrix
  out.fromRotationMatrix(rotMat);

  return out;
}
开发者ID:carussell,项目名称:nvvg,代码行数:31,代码来源:plane.cpp

示例3: rotation

 /// rotation specified by Euler angles
 Transformation Transformation::rotation(const EulerAngles& angles)
 {
   Transformation result = Transformation::rotation(Vector3d(0,0,1), angles.phi()) * 
                           Transformation::rotation(Vector3d(0,1,0), angles.theta()) *
                           Transformation::rotation(Vector3d(1,0,0), angles.psi());
   return result;
 }
开发者ID:ChengXinDL,项目名称:OpenStudio,代码行数:8,代码来源:Transformation.cpp

示例4: TEST_F

TEST_F(QuaternionTest, ToEulerAngles) {
	set(0.966, 0.259, 0, 0);
	EulerAngles ea = quaternion.uprightToEulerAngles();
	ASSERT_THAT(ea.heading(), FloatNear(0, EA_DELTA));
	ASSERT_THAT(ea.pitch(), FloatNear(30, EA_DELTA));
	ASSERT_THAT(ea.bank(), FloatNear(0, EA_DELTA));
}
开发者ID:islamaliev,项目名称:flash_math_project,代码行数:7,代码来源:QuaternionTest.cpp

示例5: yAxis

  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

示例6: SPEW

//
//#############################################################################
//#############################################################################
//
bool
EulerAngles::TestClass()
{
    SPEW((GROUP_STUFF_TEST, "Starting EulerAngle test..."));

    const EulerAngles
    a(Identity);
    EulerAngles
    b;
    const EulerAngles
    c(Pi_Over_4,Pi_Over_6,Pi_Over_3);

    Test_Assumption(!a.pitch && !a.yaw && !a.roll);
    Test_Assumption(c.pitch == Pi_Over_4 && c.yaw == Pi_Over_6 && c.roll == Pi_Over_3);

    Test_Assumption(!a);
    b = c;
    Test_Assumption(b == c);
    Test_Assumption(b != a);

    Test_Assumption(b[Y_Axis] == b.yaw);
    Test_Assumption(c[Z_Axis] == c.roll);

    b.Lerp(a,c,0.5f);
    Test_Assumption(b == EulerAngles(Stuff::Lerp(a.pitch,c.pitch,0.5f),Stuff::Lerp(a.yaw,c.yaw,0.5f),Stuff::Lerp(a.roll,c.roll,0.5f)));

    LinearMatrix4D m;
    m.BuildRotation(c);
    b = m;
    Test_Assumption(b == c);

    return true;
}
开发者ID:,项目名称:,代码行数:37,代码来源:

示例7: setRotation

 void Rotation::setRotation(EulerAngles const& _angles) {
   {
     QSignalBlocker blocker(this);
     x_->setValue(_angles.roll().degrees());
     y_->setValue(_angles.pitch().degrees());
     z_->setValue(_angles.yaw().degrees());
   }
   emit rotationChanged();
 }
开发者ID:nischu7,项目名称:omnidome,代码行数:9,代码来源:Rotation.cpp

示例8:

void
RandomEulerAngleProvider::initialize()
{
  EulerAngles angle;
  auto grain_num = _grain_tracker.getTotalFeatureCount();
  for (auto i = _angles.size(); i < grain_num; ++i)
  {
    angle.random(_random);
    _angles.push_back(angle);
  }
}
开发者ID:gnsteve,项目名称:moose,代码行数:11,代码来源:RandomEulerAngleProvider.C

示例9: eulerAnglesToQuaternion

// Routine to convert the Euler angle specifying a rotation to a quaternion. 
Quaternion eulerAnglesToQuaternion(EulerAngles e)
{
   float alpha, beta, gamma;
   Quaternion *q1, *q2, *q3;

   alpha = e.getAlpha(); beta = e.getBeta(); gamma = e.getGamma(); 

   q1 = new Quaternion( cos( (PI/180.0) * (alpha/2.0) ), sin( (PI/180.0) * (alpha/2.0) ), 0.0, 0.0 );
   q2 = new Quaternion( cos( (PI/180.0) * (beta/2.0) ), 0.0, sin( (PI/180.0) * (beta/2.0) ), 0.0 );
   q3 = new Quaternion( cos( (PI/180.0) * (gamma/2.0) ), 0.0, 0.0, sin( (PI/180.0) * (gamma/2.0) ) );

   return multiplyQuaternions( *q1, multiplyQuaternions(*q2, *q3) );
}
开发者ID:kevinaziz,项目名称:Classwork,代码行数:14,代码来源:quaternionAnimation.cpp

示例10: 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

示例11: cos

Quaternion::Quaternion(const EulerAngles &euler) :
	Vector(4)
{
	double cosPhi_2 = cos(double(euler.getPhi()) / 2.0);
	double sinPhi_2 = sin(double(euler.getPhi()) / 2.0);
	double cosTheta_2 = cos(double(euler.getTheta()) / 2.0);
	double sinTheta_2 = sin(double(euler.getTheta()) / 2.0);
	double cosPsi_2 = cos(double(euler.getPsi()) / 2.0);
	double sinPsi_2 = sin(double(euler.getPsi()) / 2.0);
	setA(cosPhi_2 * cosTheta_2 * cosPsi_2 +
	     sinPhi_2 * sinTheta_2 * sinPsi_2);
	setB(sinPhi_2 * cosTheta_2 * cosPsi_2 -
	     cosPhi_2 * sinTheta_2 * sinPsi_2);
	setC(cosPhi_2 * sinTheta_2 * cosPsi_2 +
	     sinPhi_2 * cosTheta_2 * sinPsi_2);
	setD(cosPhi_2 * cosTheta_2 * sinPsi_2 -
	     sinPhi_2 * sinTheta_2 * cosPsi_2);
}
开发者ID:CNCBASHER,项目名称:Firmware,代码行数:18,代码来源:Quaternion.cpp

示例12: 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

示例13: 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

示例14: mooseError

RankFourTensor
GrainTrackerElasticity::newGrain(unsigned int new_grain_id)
{
  EulerAngles angles;

  if (new_grain_id < _euler.getGrainNum())
    angles = _euler.getEulerAngles(new_grain_id);
  else
  {
    if (_random_rotations)
      angles.random();
    else
      mooseError("GrainTrackerElasticity has run out of grain rotation data.");
  }

  RankFourTensor C_ijkl = _C_ijkl;
  C_ijkl.rotate(RotationTensor(RealVectorValue(angles)));

  return C_ijkl;
}
开发者ID:radioactivekate,项目名称:moose,代码行数:20,代码来源:GrainTrackerElasticity.C

示例15: test

void test(string videoName) {
    const int rate = 100;

    ifstream dataFile((videoName + "/TXT_" + videoName + ".txt").c_str());

    int start = 0;
    double tmp, frames;
    dataFile >> frames >> tmp;
    for (int i = 0; i < frames; ++i) {
        dataFile >> tmp;
        if (!start)
            start = tmp;
        dataFile >> tmp;

    }

    //vector<Quaternion> q;
    int i = 0;
    Quaternion p;
    p.identity();


    while (!dataFile.eof()) {
        dataFile >> tmp;
        double x, y, z;
        dataFile >> x >> y >> z;
        EulerAngles eulerAngles(y / rate, x / rate, z / rate);
        Quaternion tq;
        tq.setToRotateInertialToObject(eulerAngles);

        if (i % (100 / rate) == 0)
            p = p * tq;
        i++;
        EulerAngles e;
        e.fromInertialToObjectQuaternion(p);
        cout << tmp - start << " " << e.pitch << " " << e.heading << " " << e.bank << endl;
    }

}
开发者ID:tonyke1993,项目名称:SensorBasedStabilization,代码行数:39,代码来源:test.cpp


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