Camera.cpp 890 B

12345678910111213141516171819202122232425262728293031323334353637
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2013 Alec Jacobson <alecjacobson@gmail.com>
  4. //
  5. // This Source Code Form is subject to the terms of the Mozilla Public License
  6. // v. 2.0. If a copy of the MPL was not distributed with this file, You can
  7. // obtain one at http://mozilla.org/MPL/2.0/.
  8. #include "Camera.h"
  9. #include "canonical_quaternions.h"
  10. #include <algorithm>
  11. igl::Camera::Camera():
  12. zoom(1.0),
  13. angle(45)
  14. {
  15. using namespace igl;
  16. using namespace std;
  17. // Defaults
  18. // canonical (X,Y) view
  19. copy(XY_PLANE_QUAT_D,XY_PLANE_QUAT_D+4,rotation);
  20. pan[0] = 0.0;
  21. pan[1] = 0.0;
  22. pan[2] = 0.0;
  23. }
  24. igl::Camera::Camera(const Camera & that):
  25. zoom(that.zoom),
  26. angle(that.angle)
  27. {
  28. pan[0] = that.pan[0];
  29. pan[1] = that.pan[1];
  30. pan[2] = that.pan[2];
  31. for(int i = 0; i<4; i++)
  32. {
  33. rotation[i] = that.rotation[i];
  34. }
  35. }