本文整理汇总了C++中pointIndexHit::setHit方法的典型用法代码示例。如果您正苦于以下问题:C++ pointIndexHit::setHit方法的具体用法?C++ pointIndexHit::setHit怎么用?C++ pointIndexHit::setHit使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pointIndexHit
的用法示例。
在下文中一共展示了pointIndexHit::setHit方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void Foam::planeSearchableSurface::findLineAll
(
const point& start,
const point& end,
pointIndexHit& hit
) const
{
hit.setMiss();
vector dir=end-start;
scalar f=plane_.normalIntersect(start,dir);
if(0<=f && f<=1) {
hit.rawPoint()=start+f*dir;
hit.setHit();
hit.setIndex(0);
}
}
示例2: v
void Foam::searchableDisk::findLine
(
const point& start,
const point& end,
pointIndexHit& info
) const
{
info = pointIndexHit(false, Zero, -1);
vector v(start - origin_);
// Decompose sample-origin into normal and parallel component
scalar parallel = (v & normal_);
if (sign(parallel) == sign((end - origin_) & normal_))
{
return;
}
// Remove the parallel component and normalise
v -= parallel*normal_;
scalar magV = mag(v);
if (magV < ROOTVSMALL)
{
v = Zero;
}
else
{
v /= magV;
}
// Set (hit or miss) to intersection of ray and plane of disk
info.setPoint(origin_ + magV*v);
if (magV <= radius_)
{
info.setHit();
info.setIndex(0);
}
}
示例3: V
//.........这里部分代码省略.........
}
}
else
{
return;
}
}
else
{
// Aligned with axis. Check if outside radius
//Pout<< "small discriminant:" << disc
// << " for start:" << start << " end:" << end
// << " magV:" << magV
// << " c:" << c << endl;
if (c > 0)
{
return;
}
}
}
else
{
if (mag(a) > ROOTVSMALL)
{
scalar sqrtDisc = sqrt(disc);
t1 = (-b - sqrtDisc)/(2*a);
t2 = (-b + sqrtDisc)/(2*a);
if (t2 < t1)
{
Swap(t1, t2);
}
if (t1 >= 0 && t1 <= magV && t1 >= tPoint1 && t1 <= tPoint2)
{
// valid. Insert sorted.
if (t1 < tNear)
{
tFar = tNear;
tNear = t1;
}
else if (t1 < tFar)
{
tFar = t1;
}
}
if (t2 >= 0 && t2 <= magV && t2 >= tPoint1 && t2 <= tPoint2)
{
// valid. Insert sorted.
if (t2 < tNear)
{
tFar = tNear;
tNear = t2;
}
else if (t2 < tFar)
{
tFar = t2;
}
}
//Pout<< "two solutions t1:" << t1 << " t2:" << t2
// << " for start:" << start << " end:" << end
// << " magV:" << magV
// << " c:" << c << endl;
}
else
{
// Aligned with axis. Check if outside radius
//Pout<< "large discriminant:" << disc
// << " small a:" << a
// << " for start:" << start << " end:" << end
// << " magV:" << magV
// << " c:" << c << endl;
if (c > 0)
{
return;
}
}
}
// Check tNear, tFar
if (tNear >= 0 && tNear <= magV)
{
near.setPoint(start+tNear*V);
near.setHit();
near.setIndex(0);
if (tFar <= magV)
{
far.setPoint(start+tFar*V);
far.setHit();
far.setIndex(0);
}
}
else if (tFar >= 0 && tFar <= magV)
{
near.setPoint(start+tFar*V);
near.setHit();
near.setIndex(0);
}
}