transforms.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #pragma once
  2. #include "../math/pod_math.h"
  3. #include <QMatrix4x4>
  4. #include <QVector3D>
  5. namespace Render::Geom {
  6. auto cylinder_between(const QVector3D &a, const QVector3D &b,
  7. float radius) -> QMatrix4x4;
  8. auto cylinder_between(const QMatrix4x4 &parent, const QVector3D &a,
  9. const QVector3D &b, float radius) -> QMatrix4x4;
  10. auto sphere_at(const QVector3D &pos, float radius) -> QMatrix4x4;
  11. auto sphere_at(const QMatrix4x4 &parent, const QVector3D &pos,
  12. float radius) -> QMatrix4x4;
  13. auto cone_from_to(const QVector3D &base_center, const QVector3D &apex,
  14. float base_radius) -> QMatrix4x4;
  15. auto cone_from_to(const QMatrix4x4 &parent, const QVector3D &base_center,
  16. const QVector3D &apex, float base_radius) -> QMatrix4x4;
  17. auto capsule_between(const QVector3D &a, const QVector3D &b,
  18. float radius) -> QMatrix4x4;
  19. auto capsule_between(const QMatrix4x4 &parent, const QVector3D &a,
  20. const QVector3D &b, float radius) -> QMatrix4x4;
  21. inline auto cylinder_between_pod(const Render::Math::Vec3 &a,
  22. const Render::Math::Vec3 &b,
  23. float radius) -> Render::Math::Mat3x4 {
  24. return Render::Math::cylinder_between_fast(a, b, radius);
  25. }
  26. inline auto cylinder_between_pod(const Render::Math::Mat3x4 &parent,
  27. const Render::Math::Vec3 &a,
  28. const Render::Math::Vec3 &b,
  29. float radius) -> Render::Math::Mat3x4 {
  30. return Render::Math::cylinder_between_fast(parent, a, b, radius);
  31. }
  32. inline auto sphere_at_pod(const Render::Math::Vec3 &pos,
  33. float radius) -> Render::Math::Mat3x4 {
  34. return Render::Math::sphere_at_fast(pos, radius);
  35. }
  36. inline auto sphere_at_pod(const Render::Math::Mat3x4 &parent,
  37. const Render::Math::Vec3 &pos,
  38. float radius) -> Render::Math::Mat3x4 {
  39. return Render::Math::sphere_at_fast(parent, pos, radius);
  40. }
  41. inline auto to_vec3(const QVector3D &v) -> Render::Math::Vec3 {
  42. return {v.x(), v.y(), v.z()};
  43. }
  44. inline auto to_qvector3d(const Render::Math::Vec3 &v) -> QVector3D {
  45. return {v.x, v.y, v.z};
  46. }
  47. } // namespace Render::Geom