My Marlin configs for Fabrikator Mini and CTC i3 Pro B
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

vector_3.h 2.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /**
  2. * Marlin 3D Printer Firmware
  3. * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
  4. *
  5. * Based on Sprinter and grbl.
  6. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
  7. *
  8. * This program is free software: you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation, either version 3 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  20. *
  21. */
  22. /**
  23. vector_3.cpp - Vector library for bed leveling
  24. Copyright (c) 2012 Lars Brubaker. All right reserved.
  25. This library is free software; you can redistribute it and/or
  26. modify it under the terms of the GNU Lesser General Public
  27. License as published by the Free Software Foundation; either
  28. version 2.1 of the License, or (at your option) any later version.
  29. This library is distributed in the hope that it will be useful,
  30. but WITHOUT ANY WARRANTY; without even the implied warranty of
  31. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  32. Lesser General Public License for more details.
  33. You should have received a copy of the GNU Lesser General Public
  34. License along with this library; if not, write to the Free Software
  35. Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  36. */
  37. #ifndef VECTOR_3_H
  38. #define VECTOR_3_H
  39. #if HAS_ABL
  40. class matrix_3x3;
  41. struct vector_3 {
  42. float x, y, z;
  43. vector_3();
  44. vector_3(float x, float y, float z);
  45. static vector_3 cross(vector_3 a, vector_3 b);
  46. vector_3 operator+(vector_3 v);
  47. vector_3 operator-(vector_3 v);
  48. void normalize();
  49. float get_length();
  50. vector_3 get_normal();
  51. void debug(const char * const title);
  52. void apply_rotation(matrix_3x3 matrix);
  53. };
  54. struct matrix_3x3 {
  55. float matrix[9];
  56. static matrix_3x3 create_from_rows(vector_3 row_0, vector_3 row_1, vector_3 row_2);
  57. static matrix_3x3 create_look_at(vector_3 target);
  58. static matrix_3x3 transpose(matrix_3x3 original);
  59. void set_to_identity();
  60. void debug(const char * const title);
  61. };
  62. void apply_rotation_xyz(matrix_3x3 rotationMatrix, float &x, float &y, float &z);
  63. #endif // HAS_ABL
  64. #endif // VECTOR_3_H