123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146 |
- #ifndef BASIS_H
- #define BASIS_H
- #if defined(_WIN32)
- # ifdef _GD_CPP_CORE_API_IMPL
- # define GD_CPP_CORE_API __declspec(dllexport)
- # else
- # define GD_CPP_CORE_API __declspec(dllimport)
- # endif
- #else
- # define GD_CPP_CORE_API
- #endif
- #include "Defs.hpp"
- #include "Vector3.hpp"
- namespace godot {
- class Quat;
- class GD_CPP_CORE_API Basis {
- public:
- Vector3 elements[3];
- Basis(const Quat& p_quat); // euler
- Basis(const Vector3& p_euler); // euler
- Basis(const Vector3& p_axis, real_t p_phi);
- Basis(const Vector3& row0, const Vector3& row1, const Vector3& row2);
- Basis(real_t xx, real_t xy, real_t xz, real_t yx, real_t yy, real_t yz, real_t zx, real_t zy, real_t zz);
- Basis();
- const Vector3& operator[](int axis) const;
- Vector3& operator[](int axis);
- void invert();
- bool isequal_approx(const Basis& a, const Basis& b) const;
- bool is_orthogonal() const;
- bool is_rotation() const;
- void transpose();
- Basis inverse() const;
- Basis transposed() const;
- real_t determinant() const;
- Vector3 get_axis(int p_axis) const;
- void set_axis(int p_axis, const Vector3& p_value);
- void rotate(const Vector3& p_axis, real_t p_phi);
- Basis rotated(const Vector3& p_axis, real_t p_phi) const;
- void scale( const Vector3& p_scale );
- Basis scaled( const Vector3& p_scale ) const;
- Vector3 get_scale() const;
- Vector3 get_euler() const;
- void set_euler(const Vector3& p_euler);
- // transposed dot products
- real_t tdotx(const Vector3& v) const;
- real_t tdoty(const Vector3& v) const;
- real_t tdotz(const Vector3& v) const;
- bool operator==(const Basis& p_matrix) const;
- bool operator!=(const Basis& p_matrix) const;
- Vector3 xform(const Vector3& p_vector) const;
- Vector3 xform_inv(const Vector3& p_vector) const;
- void operator*=(const Basis& p_matrix);
- Basis operator*(const Basis& p_matrix) const;
- void operator+=(const Basis& p_matrix);
- Basis operator+(const Basis& p_matrix) const;
- void operator-=(const Basis& p_matrix);
- Basis operator-(const Basis& p_matrix) const;
- void operator*=(real_t p_val);
- Basis operator*(real_t p_val) const;
- int get_orthogonal_index() const; // down below
- void set_orthogonal_index(int p_index); // down below
- operator String() const;
- void get_axis_and_angle(Vector3 &r_axis,real_t& r_angle) const;
- /* create / set */
- void set(real_t xx, real_t xy, real_t xz, real_t yx, real_t yy, real_t yz, real_t zx, real_t zy, real_t zz);
- Vector3 get_column(int i) const;
- Vector3 get_row(int i) const;
- Vector3 get_main_diagonal() const;
- void set_row(int i, const Vector3& p_row);
- Basis transpose_xform(const Basis& m) const;
- void orthonormalize();
- Basis orthonormalized() const;
- bool is_symmetric() const;
- Basis diagonalize();
- operator Quat() const;
- };
- }
- #endif // BASIS_H
|