Code: Select all
vector->Reset()
My question is two fold: does the
Code: Select all
vector->Reset()
Attached I have a code snippet to illustrate what I'm doing (you can assume that when the variable camera comes into play it already has the camera pointer because the values for the position vector are displayed).
Any help would be greatly appreciated,
Ryan Lovelett
Code: Select all
CComPtr<INPSmoothing> smoothingYaw;
CComPtr<INPSmoothing> smoothingPitch;
CComPtr<INPSmoothing> smoothingRoll;
CComPtr<INPSmoothing> smoothingX;
CComPtr<INPSmoothing> smoothingY;
CComPtr<INPSmoothing> smoothingZ;
CComPtr<INPCameraFrame> frame;
CComPtr<INPVector> vector;
smoothingYaw.CoCreateInstance(CLSID_NPSmoothing);
smoothingPitch.CoCreateInstance(CLSID_NPSmoothing);
smoothingRoll.CoCreateInstance(CLSID_NPSmoothing);
smoothingX.CoCreateInstance(CLSID_NPSmoothing);
smoothingY.CoCreateInstance(CLSID_NPSmoothing);
smoothingZ.CoCreateInstance(CLSID_NPSmoothing);
vector.CoCreateInstance(CLSID_NPVector);
camera->Open();
camera->Start();
while(!_kbhit()) {
camera->GetFrame(0, &frame);
if(frame != NULL) {
vector->Update(camera, frame);
vector->get_Yaw(&varYaw);
vector->get_Pitch(&varPitch);
vector->get_Roll(&varRoll);
vector->get_X(&varX);
vector->get_Y(&varY);
vector->get_Z(&varZ);
smoothingYaw->Update(varYaw, varEmpty);
smoothingPitch->Update(varPitch, varEmpty);
smoothingRoll->Update(varRoll, varEmpty);
smoothingX->Update(varX, varEmpty);
smoothingY->Update(varY, varEmpty);
smoothingZ->Update(varZ, varEmpty);
smoothingYaw->get_X(&varYaw);
smoothingPitch->get_X(&varPitch);
smoothingRoll->get_X(&varRoll);
smoothingX->get_X(&varX);
smoothingY->get_X(&varY);
smoothingZ->get_X(&varZ);
frame->Free();
frame.Release();
}
vector->Reset(); // Reset the vector to 0
}
camera->Stop();
camera->Close();
smoothingX.Release();
smoothingY.Release();
smoothingZ.Release();
smoothingYaw.Release();
smoothingPitch.Release();
smoothingRoll.Release();