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


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

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


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

示例1: domain_error

 /**
  * @brief
  *  Construct a plane with a point and a normal.
  * @param p
  *  the point
  * @param n
  *  the normal
  * @throw std::domain_error
  *  if the normal vector is the zero vector
  * @remark
  *  The plane normal is normalized if necessary.
  * @remark
  *  Let \f$X\f$ be the point and \f$\vec{n}\f$ the unnormalized plane normal, then the plane equation is given by
  *  \f{align*}{
  *  \hat{n} \cdot P + d = 0, \hat{n}=\frac{\vec{n}}{|\vec{n}|}, d = -\left(\hat{n} \cdot X\right)
  *  \f}
  *  \f$X\f$ is on the plane as
  *  \f{align*}{
  *   &\hat{n} \cdot X + d\\
  *  =&\hat{n} \cdot X + -(\hat{n} \cdot X)\\
  *  =&\hat{n} \cdot X - \hat{n} \cdot X\\
  *  =&0
  *  \f}
  */
 Plane3(const VectorType& p, const VectorType& n)
     : _n(n), _d(0.0f) {
     if (_n.normalize() == 0.0f) {
         throw std::domain_error("normal vector is zero vector");
     }
     _d = -_n.dot(p);
 }
开发者ID:carriercomm,项目名称:egoboo,代码行数:31,代码来源:Plane.hpp

示例2:

Plane::Plane(VectorType& normal, DREAM3D::SurfaceMesh::Vert_t& x) :
m_normal(normal),
m_center(x),
m_d(normal.dot(x))
{
  ensure_invariant();
}
开发者ID:chongbingbao,项目名称:DREAM3D,代码行数:7,代码来源:Plane.cpp

示例3: gaussian_kl_divergence

double gaussian_kl_divergence( const VectorType& mean0, const MatrixType& info0,
                               const VectorType& mean1, const MatrixType& info1 )
{
	Eigen::LDLT<MatrixType> ldl0( info0 );
	Eigen::LDLT<MatrixType> ldl1( info1 );

	double det0 = ldl0.vectorD().prod();
	double det1 = ldl1.vectorD().prod();
	double detDiff = std::log( det0 ) - std::log( det1 );

	MatrixType invProd = ldl0.solve( info1 );

	VectorType meanDiff = mean1 - mean0;
	double quadTerm = meanDiff.dot( info1 * meanDiff );

	return 0.5 * ( invProd.trace() + quadTerm - mean0.size() + detDiff );
}
开发者ID:Humhu,项目名称:percepto,代码行数:17,代码来源:PoliCommon.cpp

示例4: dot

 static ScalarType dot(std::size_t /*N*/, VectorType const & x, VectorType const & y)
 { return x.dot(y); }
开发者ID:canesin,项目名称:umintl,代码行数:2,代码来源:eigen.hpp

示例5: translate

	/**
	 * @remark
	 *	The first (slow) method to compute the translation of a plane \f$\hat{n} \cdot P + d = 0\f$
	 *	is to compute a point on the plane, translate the point, and compute from the new point and
	 *	and the old plane normal the new plane:
	 *	To translate a plane \f$\hat{n} \cdot P + d = 0\f$, compute a point on the plane
	 *	\f$X\f$ (i.e. a point \f$\hat{n} \cdot X + d = 0\f$) by
	 *	\f{align*}{
	 *	X = (-d) \cdot \hat{n}
	 *	\f}
	 *	Translate the point \f$X\f$ by \f$\vec{t}\f$ into a new point \f$X'\f$:
	 *	\f{align*}{
	 *	X' = X + \vec{t}
	 *	\f}
	 *	and compute the new plane
	 *	\f{align*}{
	 *	\hat{n} \cdot P + d' = 0, d' = -\left(\hat{n} \cdot X'\right)
	 *	\f}
	 * @remark
	 *	The above method is not the fastest method. Observing that the old and the new plane equation only
	 *	differ by \f$d\f$ and \f$d'\f$, a faster method of translating a plane can be devised by computing
	 *	\f$d'\f$ directly. Expanding \f$d'\f$ gives
	 *	\f{align*}{
	 *	d' =& -\left(\hat{n} \cdot X'\right)\\
	 *     =& -\left[\hat{n} \cdot \left((-d) \cdot \hat{n} + \vec{t}\right)\right]\\
	 *     =& -\left[(-d) \cdot \hat{n} \cdot \hat{n} + \hat{n} \cdot \vec{t}\right]\\
	 *     =& -\left[-d + \hat{n} \cdot \vec{t}\right]\\
	 *     =& d - \hat{n} \cdot \vec{t}
	 *	\f}
	 *	The new plane can then be computed by
	 *	\f{align*}{
	 *	\hat{n} \cdot P + d' = 0, d' = -d - \hat{n} \cdot \vec{t}
	 *	\f}
	 * @param t
	 *	the translation vector
	 * @copydoc Ego::Math::translatable
	 */
	void translate(const VectorType& t) override {
		_d -= _n.dot(t);
	}
开发者ID:carriercomm,项目名称:egoboo,代码行数:40,代码来源:Plane.hpp

示例6: distance

 /**
  * @brief
  *  Get the distance of a point from this plane.
  * @param point
  *  the point
  * @return
  *  the distance of the point from the plane.
  *  The point is in the positive (negative) half-space of the plane if the distance is positive (negative).
  *  Otherwise the point is on the plane.
  * @remark
  *  Let \f$\hat{n} \cdot P + d = 0\f$ be a plane and \f$v\f$ be some point.
  *  We claim that \f$d'=\hat{n} \cdot v + d\f$ is the signed distance of the
  *  point \f$v\f$ from the plane.
  *
  *  To show this, assume \f$v\f$ is not in the plane. Then there
  *  exists a single point \f$u\f$ on the plane which is closest to
  *  \f$v\f$ such that \f$v\f$ can be expressed by translating \f$u\f$
  *  along the plane normal by the signed distance \f$d'\f$ from
  *  \f$u\f$ to \f$v\f$ i.e. \f$v = u + d' \hat{n}\f$. Obviously,
  *  if \f$v\f$ is in the positive (negative) half-space of the plane, then
  *  \f$d'>0\f$ (\f$d' < 0\f$). We obtain now
  *  \f{align*}{
  *    &\hat{n} \cdot v + d\\
  *  = &\hat{n} \cdot (u + d' \hat{n}) + d\\
  *  = &\hat{n} \cdot u + d' (\hat{n} \cdot \hat{n}) + d\\
  *  = &\hat{n} \cdot u + d' + d\\
  *  = &\hat{n} \cdot u + d + d'\\
  *  \f}
  *  However, as \f$u\f$ is on the plane
  *  \f{align*}{
  *  = &\hat{n} \cdot u + d + d'\\
  *  = &d'
  *  \f}
  */
 ScalarType distance(const VectorType& point) const {
     return _n.dot(point) + _d;
 }
开发者ID:carriercomm,项目名称:egoboo,代码行数:37,代码来源:Plane.hpp

示例7: log_like

		double log_like(VectorType arg_vec){

			return - arg_vec.dot(arg_vec);
		}
开发者ID:toni848,项目名称:line_emission,代码行数:4,代码来源:live_points.hpp

示例8:

inline void Plane<N, T>::setNormalAndPoint(const VectorType& normal, const VectorType& point)
{
	this->normal = normal;
	dist = -(normal.dot(point));
}
开发者ID:cjhoward,项目名称:ogf,代码行数:5,代码来源:plane.hpp

示例9: eval

NumericType linear_kernel::eval(const VectorType & x, const VectorType & y) const
{
	return x.dot(y);
}
开发者ID:lazycrazyowl,项目名称:deeplearning-2,代码行数:4,代码来源:linear_kernel.cpp


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