本文整理汇总了C++中Plane3::GetNormal方法的典型用法代码示例。如果您正苦于以下问题:C++ Plane3::GetNormal方法的具体用法?C++ Plane3::GetNormal怎么用?C++ Plane3::GetNormal使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Plane3
的用法示例。
在下文中一共展示了Plane3::GetNormal方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Culled
bool Wml::Culled (const Plane3<Real>& rkPlane, const Box3<Real>& rkBox)
{
Real fTmp[3] =
{
rkBox.Extent(0)*(rkPlane.GetNormal().Dot(rkBox.Axis(0))),
rkBox.Extent(1)*(rkPlane.GetNormal().Dot(rkBox.Axis(1))),
rkBox.Extent(2)*(rkPlane.GetNormal().Dot(rkBox.Axis(2)))
};
Real fRadius = Math<Real>::FAbs(fTmp[0]) + Math<Real>::FAbs(fTmp[1]) +
Math<Real>::FAbs(fTmp[2]);
Real fPseudoDistance = rkPlane.DistanceTo(rkBox.Center());
return fPseudoDistance <= -fRadius;
}
示例2:
bool ConvexPolyhedron3<Real>::ComputeSilhouette (V3Array& rkTerminator,
const Vector3<Real>& rkEye, const Plane3<Real>& rkPlane,
const Vector3<Real>& rkU, const Vector3<Real>& rkV,
V2Array& rkSilhouette)
{
Real fEDist = rkPlane.DistanceTo(rkEye); // assert: fEDist > 0
// closest planar point to E is K = E-dist*N
Vector3<Real> kClosest = rkEye - fEDist*rkPlane.GetNormal();
// project polyhedron points onto plane
for (int i = 0; i < (int)rkTerminator.size(); i++)
{
Vector3<Real>& rkPoint = rkTerminator[i];
Real fVDist = rkPlane.DistanceTo(rkPoint);
if ( fVDist >= fEDist )
{
// cannot project vertex onto plane
return false;
}
// compute projected point Q
Real fRatio = fEDist/(fEDist-fVDist);
Vector3<Real> kProjected = rkEye + fRatio*(rkPoint - rkEye);
// compute (x,y) so that Q = K+x*U+y*V+z*N
Vector3<Real> kDiff = kProjected - kClosest;
rkSilhouette.push_back(Vector2<Real>(rkU.Dot(kDiff),rkV.Dot(kDiff)));
}
return true;
}
示例3: Culled
bool Wml::Culled (const Plane3<Real>& rkPlane,
const Ellipsoid3<Real>& rkEllipsoid, bool bUnitNormal)
{
Vector3<Real> kNormal = rkPlane.GetNormal();
Real fConstant = rkPlane.GetConstant();
if ( !bUnitNormal )
{
Real fLength = kNormal.Normalize();
fConstant /= fLength;
}
Real fDiscr = kNormal.Dot(rkEllipsoid.InverseA()*kNormal);
Real fRoot = Math<Real>::Sqrt(Math<Real>::FAbs(fDiscr));
Real fSDist = kNormal.Dot(rkEllipsoid.Center()) - fConstant;
return fSDist <= -fRoot;
}