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


C++ Pose3D::rotateY方法代码示例

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


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

示例1: simpleCalcArmJoints

void KickEngineData::simpleCalcArmJoints(const JointData::Joint& joint, JointRequest& jointRequest, const RobotDimensions& theRobotDimensions, const Vector3<>& armPos, const Vector3<>& handRotAng)
{
  float sign = joint == JointData::LShoulderPitch ? 1.f : -1.f;

  Vector3<> target =  armPos -  Vector3<>(theRobotDimensions.armOffset.x,
                                          theRobotDimensions.armOffset.y * sign,
                                          theRobotDimensions.armOffset.z);

  jointRequest.angles[joint + 0] = atan2(target.z, target.x);
  jointRequest.angles[joint + 1] = atan2(target.y * sign, sqrt(sqr(target.x) + sqr(target.z)));

  float length2ElbowJoint = Vector3<>(theRobotDimensions.upperArmLength, theRobotDimensions.yElbowShoulder, 0.f).abs();
  float angle = asin(theRobotDimensions.upperArmLength / length2ElbowJoint);

  Pose3D elbow;
  elbow.rotateY(-jointRequest.angles[joint + 0])
  .rotateZ(jointRequest.angles[joint + 1])
  .translate(length2ElbowJoint, 0.f , 0.f)
  .rotateZ(-angle)
  .translate(theRobotDimensions.yElbowShoulder, 0.f, 0.f);

  jointRequest.angles[joint + 0] = atan2(elbow.translation.z, elbow.translation.x);
  jointRequest.angles[joint + 1] = atan2(elbow.translation.y, sqrt(sqr(elbow.translation.x) + sqr(elbow.translation.z)));
  jointRequest.angles[joint + 0] = (jointRequest.angles[joint + 0] < pi) ? jointRequest.angles[joint + 0] : 0;  //clip special case

  Pose3D hand(elbow.translation);

  hand.rotateZ(handRotAng.z * sign)
  .rotateY(handRotAng.y)
  .rotateX(handRotAng.x * sign)
  .translate(theRobotDimensions.lowerArmLength, 0.f, 0.f);

  InverseKinematic::calcJointsForElbowPos(elbow.translation, hand.translation, jointRequest, joint, theRobotDimensions);
}
开发者ID:BADBDY23,项目名称:BHumanCodeRelease,代码行数:34,代码来源:KickEngineData.cpp

示例2: calculateHandPos

Pose3D ViewBikeMath::calculateHandPos(const JointData& jointData, const JointData::Joint& joint, const RobotDimensions& robotDimensions)
{
  Pose3D handPos;
  float sign = joint == JointData::LShoulderPitch ? 1.f : -1.f;

  handPos.translate(robotDimensions.armOffset.x, sign *  robotDimensions.armOffset.y, robotDimensions.armOffset.z);

  handPos.rotateY(-jointData.angles[joint]);
  handPos.rotateZ(sign * jointData.angles[joint + 1]);
  handPos.translate(robotDimensions.upperArmLength, 0, 0);

  handPos.rotateX(jointData.angles[joint + 2] * sign);
  handPos.rotateZ(sign * jointData.angles[joint + 3]);


  return handPos;
}
开发者ID:Ambaboo,项目名称:BHuman2013,代码行数:17,代码来源:ViewBikeMath.cpp


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