本文整理汇总了C++中quaternion::rotate方法的典型用法代码示例。如果您正苦于以下问题:C++ quaternion::rotate方法的具体用法?C++ quaternion::rotate怎么用?C++ quaternion::rotate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类quaternion
的用法示例。
在下文中一共展示了quaternion::rotate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: up
//! interaction between landing surface and landing gear - accumulates a force to apply to anchor
void dynamics::LandingGear::interact(const LandingSurface &surface,
const matrix3x1 &anchor,
const matrix3x1 &anchorVelocity,
const quaternion &orientation) {
matrix3x1 up(0, 1, 0);
matrix3x1 forward(1, 0, 0);
matrix3x1 disp_hat = orientation.rotate(wheel_hat);
plane plane(surface.center, surface.orientation.rotate(up));
force = matrix3x1(0, 0, 0);
static bool firstTime = true;
float displacement = plane.intersect(anchor, disp_hat);
if (displacement > 0 && displacement < dashpot.extendedLength) {
dashpot.length = displacement;
matrix3x1 vel_t = plane.project(anchorVelocity);
matrix3x1 vel_n = anchorVelocity - vel_t;
// compute dashpot velocity
dashpot.velocity = vel_n.dot(disp_hat);
// compute forces
applied = anchor + disp_hat * displacement;
float F_dashpot = dashpot.force();
float Fn = -disp_hat.dot(plane.normal()) * F_dashpot;
matrix3x1 Fd(0, 0, 0);
float vel_t_mag = vel_t.magnitude();
if (vel_t_mag > 0.1) {
matrix3x1 vel_t_hat = vel_t / vel_t_mag;
float cos_alpha = 1;
float sin_alpha = 0;
Fd = (-Fn) * (surface.mu_0 * cos_alpha + surface.mu_1 * sin_alpha) * (vel_t_hat);
}
force += Fd;
force += (-F_dashpot) * disp_hat.dot(plane.normal()) * plane.normal();
if (firstTime) {
report("Collision!");
report(" anchor = " << anchor << ", anchorVelocity = " << anchorVelocity << ", orientation = " << orientation);
report(" displacement = " << displacement);
report(" anchorVelocity = " << anchorVelocity << ", vel_t = " << vel_t << ", vel_n = " << vel_n);
report(" vel_t_hat = " << vel_t / vel_t_mag);
report(" Fn = " << Fn << ", Fd = " << Fd);
}
firstTime = false;
}
else {
dashpot.length = dashpot.extendedLength;
dashpot.velocity = 0;
force = matrix3x1(0, 0, 0);
}
}