本文整理汇总了C++中math::Vector3::Normalized方法的典型用法代码示例。如果您正苦于以下问题:C++ Vector3::Normalized方法的具体用法?C++ Vector3::Normalized怎么用?C++ Vector3::Normalized使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类math::Vector3
的用法示例。
在下文中一共展示了Vector3::Normalized方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetNewShape
DebugShape& DebugDrawer::DrawSphere(const Sphere& sphere)
{
// To access the camera's position for the horizon disc calculation use mApplication->mCamera.mTranslation
DebugShape& shape = GetNewShape();
int it;
std::vector<LineSegment> segments[4];
segments[0] = makeCircle(sphere.mCenter, Math::Vector3(1.0f, 0.0f, 0.0f), sphere.mRadius);
segments[1] = makeCircle(sphere.mCenter, Math::Vector3(0.0f, 1.0f, 0.0f), sphere.mRadius);
segments[2] = makeCircle(sphere.mCenter, Math::Vector3(0.0f, 0.0f, 1.0f), sphere.mRadius);
if(mApplication)
{
//horizon circle
Math::Vector3 dVec = sphere.mCenter - mApplication->mCamera.mTranslation;
Math::Vector3 dVecNorm = dVec.Normalized();
float radSquared = sphere.mRadius * sphere.mRadius;
float lLen = Math::Sqrt(dVec.LengthSq() - radSquared);
float rPrime = (sphere.mRadius * lLen) / dVec.Length();
float z = radSquared - (rPrime * rPrime);
Math::Vector3 newCenter = mApplication->mCamera.mTranslation + (dVec - (dVecNorm * z));
segments[3] = makeCircle(newCenter, dVecNorm, rPrime);
}
for(int i = 0; i < 4; ++i)
{
shape.mSegments.insert(shape.mSegments.end(), segments[i].begin(), segments[i].end());
}
return shape;
}