My Marlin configs for Fabrikator Mini and CTC i3 Pro B
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /*
  2. vector_3.cpp - Vector library for bed leveling
  3. Copyright (c) 2012 Lars Brubaker. All right reserved.
  4. This library is free software; you can redistribute it and/or
  5. modify it under the terms of the GNU Lesser General Public
  6. License as published by the Free Software Foundation; either
  7. version 2.1 of the License, or (at your option) any later version.
  8. This library is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. Lesser General Public License for more details.
  12. You should have received a copy of the GNU Lesser General Public
  13. License along with this library; if not, write to the Free Software
  14. Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  15. */
  16. #ifndef VECTOR_3_H
  17. #define VECTOR_3_H
  18. #ifdef ENABLE_AUTO_BED_LEVELING
  19. class matrix_3x3;
  20. struct vector_3
  21. {
  22. float x, y, z;
  23. vector_3();
  24. vector_3(float x, float y, float z);
  25. static vector_3 cross(vector_3 a, vector_3 b);
  26. vector_3 operator+(vector_3 v);
  27. vector_3 operator-(vector_3 v);
  28. void normalize();
  29. float get_length();
  30. vector_3 get_normal();
  31. void debug(const char title[]);
  32. void apply_rotation(matrix_3x3 matrix);
  33. };
  34. struct matrix_3x3
  35. {
  36. float matrix[9];
  37. static matrix_3x3 create_from_rows(vector_3 row_0, vector_3 row_1, vector_3 row_2);
  38. static matrix_3x3 create_look_at(vector_3 target);
  39. static matrix_3x3 transpose(matrix_3x3 original);
  40. void set_to_identity();
  41. void debug(const char title[]);
  42. };
  43. void apply_rotation_xyz(matrix_3x3 rotationMatrix, float &x, float& y, float& z);
  44. #endif // ENABLE_AUTO_BED_LEVELING
  45. #endif // VECTOR_3_H