本文整理汇总了C++中Line2::Constant方法的典型用法代码示例。如果您正苦于以下问题:C++ Line2::Constant方法的具体用法?C++ Line2::Constant怎么用?C++ Line2::Constant使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Line2
的用法示例。
在下文中一共展示了Line2::Constant方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: WhichSide
//----------------------------------------------------------------------------
static int WhichSide (const Line2& rkLine, int iEdgeQuantity,
const int* aiEdge, const Vector2* akPoint)
{
// establish which side of line hull is on
Real fC0;
for (int i1 = 0, i0 = iEdgeQuantity-1; i1 < iEdgeQuantity; i0 = i1++)
{
fC0 = rkLine.Normal().Dot(akPoint[aiEdge[i0]]);
if ( fC0 > rkLine.Constant()+gs_fEpsilon ) // hull on positive side
return +1;
if ( fC0 < rkLine.Constant()-gs_fEpsilon ) // hull on negative side
return -1;
fC0 = rkLine.Normal().Dot(akPoint[aiEdge[i1]]);
if ( fC0 > rkLine.Constant()+gs_fEpsilon ) // hull on positive side
return +1;
if ( fC0 < rkLine.Constant()-gs_fEpsilon ) // hull on negative side
return -1;
}
// hull is effectively collinear
return 0;
}
示例2: OnSameSide
//----------------------------------------------------------------------------
static int OnSameSide (const Line2& rkLine, int iEdgeQuantity,
const int* aiEdge, const Vector2* akPoint)
{
// test if all points on same side of line Dot(N,X) = c
Real fC0;
int iPosSide = 0, iNegSide = 0;
for (int i1 = 0, i0 = iEdgeQuantity-1; i1 < iEdgeQuantity; i0 = i1++)
{
fC0 = rkLine.Normal().Dot(akPoint[aiEdge[i0]]);
if ( fC0 > rkLine.Constant() + gs_fEpsilon )
iPosSide++;
else if ( fC0 < rkLine.Constant() - gs_fEpsilon )
iNegSide++;
if ( iPosSide && iNegSide )
{
// line splits point set
return 0;
}
fC0 = rkLine.Normal().Dot(akPoint[aiEdge[i1]]);
if ( fC0 > rkLine.Constant() + gs_fEpsilon )
iPosSide++;
else if ( fC0 < rkLine.Constant() - gs_fEpsilon )
iNegSide++;
if ( iPosSide && iNegSide )
{
// line splits point set
return 0;
}
}
return iPosSide ? +1 : -1;
}