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


C++ vec::IsZero方法代码示例

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


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

示例1: ClosestPointLineLine

MATH_BEGIN_NAMESPACE

/// Computes the closest point pair on two lines.
/** The first line is specified by two points start0 and end0. The second line is specified by
	two points start1 and end1.
	The implementation of this function follows http://paulbourke.net/geometry/lineline3d/ .
	@param v0 The starting point of the first line.
	@param v10 The direction vector of the first line. This can be unnormalized.
	@param v2 The starting point of the second line.
	@param v32 The direction vector of the second line. This can be unnormalized.
	@param d [out] Receives the normalized distance of the closest point along the first line.
	@param d2 [out] Receives the normalized distance of the closest point along the second line.
	@return Returns the closest point on line start0<->end0 to the second line.
	@note This is a low-level utility function. You probably want to use ClosestPoint() or Distance() instead.
	@see ClosestPoint(), Distance(). */
void Line::ClosestPointLineLine(const vec &v0, const vec &v10, const vec &v2, const vec &v32, float &d, float &d2)
{
    assume(!v10.IsZero());
    assume(!v32.IsZero());
    vec v02 = v0 - v2;
    float d0232 = v02.Dot(v32);
    float d3210 = v32.Dot(v10);
    float d3232 = v32.Dot(v32);
    assume(d3232 != 0.f); // Don't call with a zero direction vector.
    float d0210 = v02.Dot(v10);
    float d1010 = v10.Dot(v10);
    float denom = d1010*d3232 - d3210*d3210;
    if (denom != 0.f)
        d = (d0232*d3210 - d0210*d3232) / denom;
    else
        d = 0.f;
    d2 = (d0232 + d * d3210) / d3232;
}
开发者ID:jnmacd,项目名称:MathGeoLib,代码行数:33,代码来源:Line.cpp


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