本文整理汇总了C++中VectorType::length方法的典型用法代码示例。如果您正苦于以下问题:C++ VectorType::length方法的具体用法?C++ VectorType::length怎么用?C++ VectorType::length使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VectorType
的用法示例。
在下文中一共展示了VectorType::length方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: normal
Plane(ATy_ A, BTy_ B, CTy_ C, DTy_ D) : normal(A, B, C)
{
ValueType nlen = static_cast<ValueType>(1) / static_cast<ValueType>(normal.length());
distanceConstant = -D * nlen;
// renormalize normal
normal = normal * nlen;
}
示例2: domain_error
/**
* @brief
* Create a plane from a plane equation \f$a + b + c + d = 0\f$.
* @param a, b, c, d
* the plane equation
* @remark
* Given a plane equation \f$a + b + c + d = 0\f$, the normal-distance form
* \f$(\hat{n}',d')\f$ is defined as \f$\hat{n}' = \frac{\vec{n}}{|\vec{n}'|}\f$
* and \f$d' = \frac{d}{|\vec{n}'|}\f$ where \f$\vec{n}' = (a,b,c)\f$.
*/
Plane3(const ScalarType& a, const ScalarType& b, const ScalarType& c, const ScalarType& d)
: _n(a, b, c), _d(d) {
auto l = _n.length();
if (0.0f == l) {
throw std::domain_error("normal vector is zero vector");
}
auto il = 1.0f / l;
_n *= il;
_d *= il;
}
示例3: plane_eq
Vector4d plane_eq() const
{
Vector4d eq;
double s = 1.0 / normal.length();//sqrt( normal.x * normal.x + normal.y * normal.y + normal.z * normal.z );
Vector3d v(normal * distanceConstant);
eq.x = normal.x * s;
eq.y = normal.y * s;
eq.z = normal.z * s;
eq.w = -( eq.x * v.x + eq.y * v.y + eq.z * v.z );
return eq;
}