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


C++ Transform3d::inverse_transform_point方法代码示例

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


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

示例1: calc_signed_dist

/// Computes the distance from another sphere primitive
double SpherePrimitive::calc_signed_dist(shared_ptr<const SpherePrimitive> s, Point3d& pthis, Point3d& ps) const
{
  // get the transform from s to this
  Transform3d T = Pose3d::calc_relative_pose(ps.pose, pthis.pose);

  // compute the distance
  double d = T.x.norm() - _radius - s->_radius;

  // setup sphere centers in alternate frames
  Point3d ps_c(0.0, 0.0, 0.0, ps.pose);
  Point3d pthis_c(0.0, 0.0, 0.0, pthis.pose);

  // setup closest points
  pthis = T.transform_point(ps_c);
  pthis.normalize();
  ps = T.inverse_transform_point(pthis_c);
  ps.normalize();

  // scale closest points appropriately
  if (d > 0.0)
  {
    pthis *= _radius;
    ps *= s->_radius;
  }
  else
  {
    pthis *= _radius+d;
    ps *= s->_radius+d;
  }

  return d;
}
开发者ID:PositronicsLab,项目名称:Moby,代码行数:33,代码来源:SpherePrimitive.cpp

示例2: calc_signed_dist

/// Gets the distance from a sphere primitive
double PlanePrimitive::calc_signed_dist(shared_ptr<const SpherePrimitive> s, Point3d& pthis, Point3d& ps) const
{
  const unsigned Y = 1;

  assert(_poses.find(const_pointer_cast<Pose3d>(pthis.pose)) != _poses.end());

  // compute the transform from the sphere to the plane
  Transform3d T = Pose3d::calc_relative_pose(ps.pose, pthis.pose);

  // transform the sphere center to the plane space
  Point3d ps_c(0.0, 0.0, 0.0, ps.pose);
  Point3d ps_c_this = T.transform_point(ps_c);

  // get the lowest point on the sphere (toward the heightmap)
  Vector3d vdir(0.0, -1.0*s->get_radius(), 0.0, pthis.pose);

  // get the lowest point on the sphere
  Point3d sphere_lowest = ps_c_this + vdir;

  // setup the point on the plane
  pthis = ps_c_this;
  pthis[Y] = 0.0;

  // get the height of the sphere center
  ps = T.inverse_transform_point(sphere_lowest);
  return sphere_lowest[Y];
}
开发者ID:PositronicsLab,项目名称:Moby,代码行数:28,代码来源:PlanePrimitive.cpp


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