clean ups - coding standard

This commit is contained in:
Al Bernstein 2017-04-06 11:23:33 -07:00
parent 4a17112478
commit 001c92416b

View file

@ -248,7 +248,6 @@ void KinectPlugin::init() {
auto preference = new CheckPreference(KINECT_PLUGIN, "Extra Debugging", debugGetter, debugSetter); auto preference = new CheckPreference(KINECT_PLUGIN, "Extra Debugging", debugGetter, debugSetter);
preferences->addPreference(preference); preferences->addPreference(preference);
} }
} }
bool KinectPlugin::isSupported() const { bool KinectPlugin::isSupported() const {
@ -494,15 +493,15 @@ void KinectPlugin::ProcessBody(INT64 time, int bodyCount, IBody** bodies) {
//_joints[j].orientation = jointOrientation; //_joints[j].orientation = jointOrientation;
if (joints[j].JointType == JointType_HandRight) { if (joints[j].JointType == JointType_HandRight) {
static const quat kinectToHandRight = glm::angleAxis(-PI / 2.0f, Vectors::UNIT_Y); static const quat kinectToHandRight = glm::angleAxis(-PI / 2.0f, Vectors::UNIT_Y);
// add moving average of orientation quaternion // add moving average of orientation quaternion
glm::quat jointTmp = jointOrientation * kinectToHandRight; glm::quat jointTmp = jointOrientation * kinectToHandRight;
_joints[j].orientation = QMAR(jointTmp); _joints[j].orientation = QMAR(jointTmp);
} else if (joints[j].JointType == JointType_HandLeft) { } else if (joints[j].JointType == JointType_HandLeft) {
// To transform from Kinect to our LEFT Hand.... Postive 90 deg around Y // To transform from Kinect to our LEFT Hand.... Postive 90 deg around Y
static const quat kinectToHandLeft = glm::angleAxis(PI / 2.0f, Vectors::UNIT_Y); static const quat kinectToHandLeft = glm::angleAxis(PI / 2.0f, Vectors::UNIT_Y);
// add moving average of orientation quaternion // add moving average of orientation quaternion
glm::quat jointTmp = jointOrientation * kinectToHandLeft; glm::quat jointTmp = jointOrientation * kinectToHandLeft;
_joints[j].orientation = QMAL(jointTmp); _joints[j].orientation = QMAL(jointTmp);
} else { } else {
_joints[j].orientation = jointOrientation; _joints[j].orientation = jointOrientation;
} }
@ -652,41 +651,41 @@ void KinectPlugin::InputDevice::clearState() {
glm::quat KinectPlugin::QMAL(glm::quat q) glm::quat KinectPlugin::QMAL(glm::quat q)
{ {
if (glm::dot(_q_barL, q) < 0) if (glm::dot(_q_barL, q) < 0) {
_q_barL = (1 - _deltaL)*_q_barL + -_deltaL*q; _q_barL = (1 - _deltaL) * _q_barL + -_deltaL * q;
else }
_q_barL = (1 - _deltaL)*_q_barL + _deltaL*q; else {
_q_barL = (1 - _deltaL) * _q_barL + _deltaL * q;
_q_barL = glm::normalize(_q_barL); }
_q_barL = glm::normalize(_q_barL);
if (_debug) if (_debug)
{ {
qDebug() << __FUNCTION__ << "q = " << q.x << "," << q.y << "," << q.z << "," << q.w; qDebug() << __FUNCTION__ << "q = " << q.x << "," << q.y << "," << q.z << "," << q.w;
qDebug() << __FUNCTION__ << "_q_barL = " << _q_barL.x << "," << _q_barL.y << "," << _q_barL.z << "," << _q_barL.w; qDebug() << __FUNCTION__ << "_q_barL = " << _q_barL.x << "," << _q_barL.y << "," << _q_barL.z << "," << _q_barL.w;
} }
return _q_barL; return _q_barL;
} }
glm::quat KinectPlugin::QMAR(glm::quat q) glm::quat KinectPlugin::QMAR(glm::quat q)
{ {
if (glm::dot(_q_barR, q) < 0) if (glm::dot(_q_barR, q) < 0){
_q_barR = (1 - _deltaR)*_q_barR + -_deltaR*q; _q_barR = (1 - _deltaR)*_q_barR + -_deltaR*q;
else }
_q_barR = (1 - _deltaR)*_q_barR + _deltaR*q; else {
_q_barR = (1 - _deltaR)*_q_barR + _deltaR*q;
_q_barR = glm::normalize(_q_barR); }
_q_barR = -_q_barR;
if (_debug)
{
qDebug() << __FUNCTION__ << "q = " << q.x << "," << q.y << "," << q.z << "," << q.w;
qDebug() << __FUNCTION__ << "_q_barL = " << _q_barR.x << "," << _q_barR.y << "," << _q_barR.z << "," << _q_barR.w;
}
return _q_barR; _q_barR = glm::normalize(_q_barR);
_q_barR = -_q_barR;
if (_debug)
{
qDebug() << __FUNCTION__ << "q = " << q.x << "," << q.y << "," << q.z << "," << q.w;
qDebug() << __FUNCTION__ << "_q_barL = " << _q_barR.x << "," << _q_barR.y << "," << _q_barR.z << "," << _q_barR.w;
}
return _q_barR;
} }