diff options
author | Karroffel <therzog@mail.de> | 2017-05-12 21:53:07 +0200 |
---|---|---|
committer | Karroffel <therzog@mail.de> | 2017-05-12 21:53:07 +0200 |
commit | cf30b0f39ddb2c6acad5d22655c4bca9015d7502 (patch) | |
tree | 45a4df6ff16450b334d6c8856a74f4f47f3e9336 /include/core/Basis.hpp | |
parent | 3969bcf07857b1a4af391bbddb924388cc7f44bb (diff) | |
download | redot-cpp-cf30b0f39ddb2c6acad5d22655c4bca9015d7502.tar.gz |
rewrote binding generator in python
Diffstat (limited to 'include/core/Basis.hpp')
-rw-r--r-- | include/core/Basis.hpp | 146 |
1 files changed, 146 insertions, 0 deletions
diff --git a/include/core/Basis.hpp b/include/core/Basis.hpp new file mode 100644 index 0000000..eda3d09 --- /dev/null +++ b/include/core/Basis.hpp @@ -0,0 +1,146 @@ +#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 |