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


C++ V3D::nullVector方法代码示例

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


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

示例1: rotate

void UnwrappedSphere::rotate(const UnwrappedDetector &udet,
                             Mantid::Kernel::Quat &R) const {
  // rotation from the global axes to those where
  // the z axis points to the detector
  Mantid::Kernel::Quat R1;
  // direction in which to look: from sample to detector
  Mantid::Kernel::V3D eye;
  eye = m_pos - udet.detector->getPos();
  if (!eye.nullVector()) {
    InstrumentActor::rotateToLookAt(eye, m_zaxis, R1);
  }
  // add detector's own rotation
  R = R1 * udet.detector->getRotation();
}
开发者ID:liyulun,项目名称:mantid,代码行数:14,代码来源:UnwrappedSphere.cpp

示例2: rotate

void UnwrappedCylinder::rotate(const UnwrappedDetector &udet,
                               Mantid::Kernel::Quat &R) const {
  // direction in which to look
  Mantid::Kernel::V3D eye;
  const auto &componentInfo = m_instrActor->componentInfo();
  // rotation from the global axes to those where
  // the z axis points to the detector
  Mantid::Kernel::Quat R1;
  eye = m_pos - componentInfo.position(udet.detIndex);
  if (!eye.nullVector()) {
    // eye must point towards the detector and be perpendicular to the
    // cylinder's axis
    Mantid::Kernel::V3D up = m_zaxis;
    up.normalize();
    eye = eye - up * eye.scalar_prod(up);
    if (!eye.nullVector()) {
      eye.normalize();
      InstrumentActor::rotateToLookAt(eye, up, R1);
    }
  }
  // add detector's own rotation
  R = R1 * componentInfo.rotation(udet.detIndex);
}
开发者ID:samueljackson92,项目名称:mantid,代码行数:23,代码来源:UnwrappedCylinder.cpp

示例3: rotateToLookAt

/**
 * Calculate a rotation to look in a particular direction.
 *
 * @param eye :: A direction to look in
 * @param up :: A vector showing the 'up' direction after the rotation. It doesn't have to be normal to eye
 *   just non-collinear. If up is collinear to eye the actual 'up' direction is undefined.
 * @param R :: The result rotation.
 */
void InstrumentActor::rotateToLookAt(const Mantid::Kernel::V3D &eye, const Mantid::Kernel::V3D &up, Mantid::Kernel::Quat &R)
{
    if ( eye.nullVector() )
    {
        throw std::runtime_error("The eye vector is null in InstrumentActor::rotateToLookAt.");
    }

    // Basis vectors of the OpenGL reference frame. Z points into the screen, Y points up.
    const Mantid::Kernel::V3D X(1,0,0);
    const Mantid::Kernel::V3D Y(0,1,0);
    const Mantid::Kernel::V3D Z(0,0,1);

    Mantid::Kernel::V3D x,y,z;
    z = eye;
    z.normalize();
    y = up;
    x = y.cross_prod(z);
    if (x.nullVector())
    {
        // up || eye
        if ( z.X() != 0.0 )
        {
            x.setY(1.0);
        }
        else if ( z.Y() != 0.0 )
        {
            x.setZ(1.0);
        }
        else
        {
            x.setX(1.0);
        }
    }
    x.normalize();
    y = z.cross_prod(x);

    BasisRotation(x,y,z,X,Y,Z,R);
}
开发者ID:stothe2,项目名称:mantid,代码行数:46,代码来源:InstrumentActor.cpp


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