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


C++ VectorType::length方法代码示例

本文整理汇总了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;
	}
开发者ID:billw2012,项目名称:BGalaxy1,代码行数:7,代码来源:plane.hpp

示例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;
 }
开发者ID:carriercomm,项目名称:egoboo,代码行数:20,代码来源:Plane.hpp

示例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;
	}
开发者ID:billw2012,项目名称:BGalaxy1,代码行数:13,代码来源:plane.hpp


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