本文整理汇总了C++中Point3::normalize方法的典型用法代码示例。如果您正苦于以下问题:C++ Point3::normalize方法的具体用法?C++ Point3::normalize怎么用?C++ Point3::normalize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Point3
的用法示例。
在下文中一共展示了Point3::normalize方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: accelerate
void Object::accelerate(Point3 velocity)
{
Point3 temp = this->velocity + velocity;
float speed1 = this->velocity.len();
float speed2 = velocity.len();
float newSpeed = (speed1 + speed2)/(1 + speed1 * speed2/(MAX_SPEED * MAX_SPEED));
this->velocity = temp.normalize() * newSpeed;
}
示例2:
/* ************************************************************************* */
Unit3 Unit3::FromPoint3(const Point3& point, OptionalJacobian<2,3> H) {
// 3*3 Derivative of representation with respect to point is 3*3:
Matrix3 D_p_point;
Point3 normalized = point.normalize(H ? &D_p_point : 0);
Unit3 direction;
direction.p_ = normalized.vector();
if (H)
*H << direction.basis().transpose() * D_p_point;
return direction;
}
示例3:
Plane(Point3 _AA, Point3 _BB, Point3 _CC)
{
A=_AA;
B=_BB;
C=_CC;
Point3 normal = (B-A)*(C-A);
N = normal.normalize();
a = N.x;
b = N.y;
c = N.z;
d = -(A^N);
O = Point3(-d*a, -d*b, -d*c);
if(A!=O) X = (A-O).normalize();
else X = (B-O).normalize();
Y = normal*X;
}