My Marlin configs for Fabrikator Mini and CTC i3 Pro B
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

hilbert_curve.h 1.8KB

1234567891011121314151617181920212223242526272829303132
  1. /*******************
  2. * hilbert_curve.h *
  3. *******************/
  4. /****************************************************************************
  5. * Written By Marcio Teixeira 2021 - SynDaver Labs, Inc. *
  6. * *
  7. * This program is free software: you can redistribute it and/or modify *
  8. * it under the terms of the GNU General Public License as published by *
  9. * the Free Software Foundation, either version 3 of the License, or *
  10. * (at your option) any later version. *
  11. * *
  12. * This program is distributed in the hope that it will be useful, *
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of *
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
  15. * GNU General Public License for more details. *
  16. * *
  17. * To view a copy of the GNU General Public License, go to the following *
  18. * location: <https://www.gnu.org/licenses/>. *
  19. ****************************************************************************/
  20. #pragma once
  21. class hilbert_curve {
  22. public:
  23. typedef bool (*callback_ptr)(uint8_t x, uint8_t y, void *data);
  24. static bool search(callback_ptr func, void *data);
  25. static bool search_from(uint8_t x, uint8_t y, callback_ptr func, void *data);
  26. static bool search_from_closest(const xy_pos_t &pos, callback_ptr func, void *data);
  27. private:
  28. static bool hilbert(int8_t x, int8_t y, int8_t xi, int8_t xj, int8_t yi, int8_t yj, uint8_t n, callback_ptr func, void *data);
  29. };