本文整理汇总了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();
}
示例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);
}
示例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);
}