本文整理汇总了C++中FVector::normalize方法的典型用法代码示例。如果您正苦于以下问题:C++ FVector::normalize方法的具体用法?C++ FVector::normalize怎么用?C++ FVector::normalize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FVector
的用法示例。
在下文中一共展示了FVector::normalize方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CStarVector
void CStarCamera::fn2(FVector v1, FVector v2, FVector v3) {
if (_matrixRow == -1) {
FVector tempV;
tempV._z = _viewport._field10;
v3._z = v1._z;
tempV._x = _viewport._centerVector._z * v1._y * v1._z / _viewport._centerVector._x;
v3._y = _viewport._centerVector._y * tempV._z * v3._x / _viewport._centerVector._x;
v3._x = _viewport._centerVector._y * v1._x * v1._z / _viewport._centerVector._x - _viewport._valArray[2];
tempV._y = _viewport._centerVector._z * tempV._z * v3._y / _viewport._centerVector._x;
tempV._x = tempV._x - _viewport._valArray[2];
v3.normalize();
tempV.normalize();
FMatrix matrix = _viewport.getOrientation();
const FVector &pos = _viewport._position;
_mover->proc10(v3, tempV, pos, matrix);
CStarVector *sv = new CStarVector(this, v2);
_mover->setVector(sv);
}
}
示例2: getAnglesAsVect
FVector FVector::getAnglesAsVect() const {
FVector vector = *this;
FVector dest;
if (!vector.normalize(dest._x)) {
// Makes this vector have magnitude=1, put the scale amount in dest._x,
// but if it is unsuccessful, crash
assert(dest._x);
}
dest._y = acos(vector._y); // radian distance/angle that this vector's y component is from the +y axis,
// result is restricted to [0,pi]
dest._z = atan2(vector._x,vector._z); // result is restricted to [-pi,pi]
return dest;
}
示例3:
/*
* Note - do not use - needs to be fixed
*/
bool C3ds::segInTriangle(FVector p, FVector d, FVector* v) {
for (int j = 2, i = 0; i < 3; j = i, i++) {
FVector e = v[i] - v[j];
FVector h = p - v[j];
FVector f = e % d;
float dot = h * f;
if (dot > 0.0f) {
return false;
}
}
FVector a = (v[1] - v[0]);
FVector b = (v[2] - v[0]);
FVector segNormal = (a % b).normalize();
FVector proj = b.normalize();
proj = a * (proj * proj);
if (proj.magnitude() >= d.magnitude()) {
std::cout << proj.magnitude() << std::endl;
return true;
} else
return false;
}