void NDynamicObject::updateFromVision(VisionSense vs) { setDistance(vs.distanceToSelf); setLocalPos(vs.localPos); if (WM.CanLocalize()) setGlobalPos(WM.getVisionPerceptorMatrix()*pos_local); }
//=========================================================================== bool cCamera::set(const cVector3d& a_localPosition, const cVector3d& a_localLookAt, const cVector3d& a_localUp) { // copy new values to temp variables cVector3d pos = a_localPosition; cVector3d lookAt = a_localLookAt; cVector3d up = a_localUp; cVector3d Cy; // check validity of vectors if (pos.distancesq(lookAt) < C_SMALL) { return (false); } if (up.lengthsq() < C_SMALL) { return (false); } // compute new rotation matrix pos.sub(lookAt); pos.normalize(); up.normalize(); up.crossr(pos, Cy); if (Cy.lengthsq() < C_SMALL) { return (false); } Cy.normalize(); pos.crossr(Cy,up); // update frame with new values setLocalPos(a_localPosition); cMatrix3d localRot; localRot.setCol(pos, Cy, up); setLocalRot(localRot); // return success return (true); }
//Constructor GuiTimer::GuiTimer(iPoint pos, const char *tex_path) : crono("00 : 00", 0) { setLocalPos(pos.x, pos.y); crono.setLocalPos(pos.x + 62, pos.y + 18); type = TIMER; active = false; seconds = minutes = 0; monitor = app->tex->loadTexture(tex_path); }