godot-cpp/include/godot_cpp/core/Basis.hpp

147 lines
2.7 KiB
C++
Raw Normal View History

2017-03-03 02:14:34 +00:00
#ifndef BASIS_H
#define BASIS_H
2017-03-15 22:19:58 +00:00
#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
2017-03-06 07:49:24 +00:00
#include "Defs.hpp"
2017-03-06 07:49:24 +00:00
#include "Vector3.hpp"
2017-03-03 02:14:34 +00:00
namespace godot {
class Quat;
2017-03-15 22:19:58 +00:00
class GD_CPP_CORE_API Basis {
2017-03-03 02:14:34 +00:00
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);
2017-03-03 02:14:34 +00:00
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);
2017-03-03 02:14:34 +00:00
Basis();
2017-03-03 02:14:34 +00:00
const Vector3& operator[](int axis) const;
Vector3& operator[](int axis);
2017-03-03 02:14:34 +00:00
void invert();
2017-03-03 02:14:34 +00:00
bool isequal_approx(const Basis& a, const Basis& b) const;
2017-03-03 02:14:34 +00:00
bool is_orthogonal() const;
2017-03-03 02:14:34 +00:00
bool is_rotation() const;
2017-03-03 02:14:34 +00:00
void transpose();
2017-03-03 02:14:34 +00:00
Basis inverse() const;
2017-03-03 02:14:34 +00:00
Basis transposed() const;
2017-03-03 02:14:34 +00:00
real_t determinant() const;
2017-03-03 02:14:34 +00:00
Vector3 get_axis(int p_axis) const;
2017-03-03 02:14:34 +00:00
void set_axis(int p_axis, const Vector3& p_value);
2017-03-03 02:14:34 +00:00
void rotate(const Vector3& p_axis, real_t p_phi);
2017-03-03 02:14:34 +00:00
Basis rotated(const Vector3& p_axis, real_t p_phi) const;
2017-03-03 02:14:34 +00:00
void scale( const Vector3& p_scale );
2017-03-03 02:14:34 +00:00
Basis scaled( const Vector3& p_scale ) const;
2017-03-03 02:14:34 +00:00
Vector3 get_scale() const;
2017-03-03 02:14:34 +00:00
Vector3 get_euler() const;
2017-03-03 02:14:34 +00:00
void set_euler(const Vector3& p_euler);
2017-03-03 02:14:34 +00:00
// transposed dot products
real_t tdotx(const Vector3& v) const;
real_t tdoty(const Vector3& v) const;
real_t tdotz(const Vector3& v) const;
2017-03-03 02:14:34 +00:00
bool operator==(const Basis& p_matrix) const;
2017-03-03 02:14:34 +00:00
bool operator!=(const Basis& p_matrix) const;
2017-03-03 02:14:34 +00:00
Vector3 xform(const Vector3& p_vector) const;
2017-03-03 02:14:34 +00:00
Vector3 xform_inv(const Vector3& p_vector) const;
void operator*=(const Basis& p_matrix);
2017-03-03 02:14:34 +00:00
Basis operator*(const Basis& p_matrix) const;
2017-03-03 02:14:34 +00:00
void operator+=(const Basis& p_matrix);
2017-03-03 02:14:34 +00:00
Basis operator+(const Basis& p_matrix) const;
2017-03-03 02:14:34 +00:00
void operator-=(const Basis& p_matrix);
2017-03-03 02:14:34 +00:00
Basis operator-(const Basis& p_matrix) const;
2017-03-03 02:14:34 +00:00
void operator*=(real_t p_val);
2017-03-03 02:14:34 +00:00
Basis operator*(real_t p_val) const;
2017-03-03 02:14:34 +00:00
int get_orthogonal_index() const; // down below
2017-03-03 02:14:34 +00:00
void set_orthogonal_index(int p_index); // down below
2017-03-03 02:14:34 +00:00
operator String() const;
2017-03-03 02:14:34 +00:00
void get_axis_and_angle(Vector3 &r_axis,real_t& r_angle) const;
2017-03-03 02:14:34 +00:00
/* create / set */
2017-03-03 02:14:34 +00:00
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);
2017-03-03 02:14:34 +00:00
Vector3 get_column(int i) const;
2017-03-03 02:14:34 +00:00
Vector3 get_row(int i) const;
Vector3 get_main_diagonal() const;
2017-03-03 02:14:34 +00:00
void set_row(int i, const Vector3& p_row);
2017-03-03 02:14:34 +00:00
Basis transpose_xform(const Basis& m) const;
2017-03-03 02:14:34 +00:00
void orthonormalize();
Basis orthonormalized() const;
bool is_symmetric() const;
2017-03-03 02:14:34 +00:00
Basis diagonalize();
2017-03-03 02:14:34 +00:00
operator Quat() const;
};
2017-03-03 02:14:34 +00:00
}
#endif // BASIS_H