IRLock.cpp 533 B

12345678910111213141516171819202122232425
  1. /*
  2. * IRLock.cpp
  3. *
  4. * Created on: Nov 12, 2014
  5. * Author: MLandes
  6. */
  7. #include "IRLock.h"
  8. // retrieve body frame unit vector in direction of target
  9. // returns true if data is available
  10. bool IRLock::get_unit_vector_body(Vector3f& ret) const
  11. {
  12. // return false if we have no target
  13. if (!_flags.healthy) {
  14. return false;
  15. }
  16. // use data from first (largest) object
  17. ret.x = -_target_info.pos_y;
  18. ret.y = _target_info.pos_x;
  19. ret.z = _target_info.pos_z;
  20. ret /= ret.length();
  21. return true;
  22. }