本文整理汇总了C++中Span::NearestPoint方法的典型用法代码示例。如果您正苦于以下问题:C++ Span::NearestPoint方法的具体用法?C++ Span::NearestPoint怎么用?C++ Span::NearestPoint使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Span
的用法示例。
在下文中一共展示了Span::NearestPoint方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: NearestPointToSpan
Point Span::NearestPointToSpan(const Span& p, double &d)const
{
Point midpoint = MidParam(0.5);
Point np = p.NearestPoint(m_p);
Point best_point = m_p;
double dist = np.dist(m_p);
if(p.m_start_span)dist -= (CArea::m_accuracy * 2); // give start of curve most priority
Point npm = p.NearestPoint(midpoint);
double dm = npm.dist(midpoint) - CArea::m_accuracy; // lie about midpoint distance to give midpoints priority
if(dm < dist){dist = dm; best_point = midpoint;}
Point np2 = p.NearestPoint(m_v.m_p);
double dp2 = np2.dist(m_v.m_p);
if(dp2 < dist){dist = dp2; best_point = m_v.m_p;}
d = dist;
return best_point;
}