本文整理汇总了C++中Plane::DistTo方法的典型用法代码示例。如果您正苦于以下问题:C++ Plane::DistTo方法的具体用法?C++ Plane::DistTo怎么用?C++ Plane::DistTo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Plane
的用法示例。
在下文中一共展示了Plane::DistTo方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
//---------------------------------------------------------------------------------------
void Portal::Split(Plane& plane, Portal& a, Portal& b)
{
a.CopyProps(*this);
b.CopyProps(*this);
if((_n == plane._n && _c == plane._c) ||
(_n == -plane._n && _c == -plane._c) )
{
#ifdef WINDOWS
# pragma message("see this")
#endif
a._vxes = _vxes;
b._vxes = _vxes;
return;
}
v3d_t iv;
v3d_t itxB = *_vxes.begin();
v3d_t itxA = _vxes.back();
f32_t fB;
f32_t fA = plane.DistTo(itxA);
FOREACH(vvector<v3d_t>, _vxes, vxI)
{
itxB = *vxI;
fB = plane.DistTo(itxB);
if(fB > GEpsilon)
{
if(fA < -GEpsilon)
{
f32_t t = -fA /(fB - fA);
iv.interpolate(itxA,itxB,t);
a._vxes << iv;
b._vxes << iv;
}
a._vxes<<itxB;
}
else if(fB < -GEpsilon)
{
if(fA > GEpsilon)
{
f32_t t = -fA /(fB - fA); // t of segment
iv.interpolate(itxA,itxB,t);
a._vxes <<iv;
b._vxes <<iv;
}
b._vxes<<itxB;
}
else
{
a._vxes << itxB;
b._vxes << itxB;
}
itxA = itxB;
fA = fB;
}
示例2: if
void Face::Split(Plane& plane, Face& frontFace,
Face& backFace)
{
Vertex vertex1 = m_points.first();
Vertex vertex2 = m_points.back();
float fB;
float fA = plane.DistTo(vertex2._xyz);
for_each(vertex in m_poins)
{
vertex1 = *vertex;
fB = plane.DistTo(vertex1._xyz);
if(fB > EPSILON)
{
if(fA < -EPSILON)
{
float t = -fA /(fB - fA);
Vertex midvertex = vertex1 +
(vertex2-vertex1)*t;
frontFace << midvertex;
backFace << midvertex;
}
frontFace<<vertex1;
}
else if(fB < -EPSILON)
{
if(fA > EPSILON)
{
float t = -fA /(fB - fA);
Vertex midvertex = vertex1 +
(vertex2-vertex1)*t;
frontFace<<midvertex;
backFace <<midvertex;
}
backFace <<vertex1;
}
else
{
frontFace << vertex1;
backFace << vertex1;
}
vertex2 = vertex1;
fA = fB;
}