add $whatobj command
This commit is contained in:
@@ -5,6 +5,10 @@
|
||||
|
||||
#include "Text.hh"
|
||||
|
||||
constexpr double radians_for_fixed_point_angle(uint16_t angle) {
|
||||
return static_cast<double>(angle * 2 * M_PI) / 0x10000;
|
||||
}
|
||||
|
||||
struct VectorXZF {
|
||||
le_float x = 0.0;
|
||||
le_float z = 0.0;
|
||||
@@ -34,6 +38,12 @@ struct VectorXZF {
|
||||
return ((this->x * this->x) + (this->z * this->z));
|
||||
}
|
||||
|
||||
inline VectorXZF rotate_y(double angle) const {
|
||||
double s = sin(angle);
|
||||
double c = cos(angle);
|
||||
return VectorXZF(this->x * c - this->z * s, this->x * s + this->z * c);
|
||||
}
|
||||
|
||||
inline std::string str() const {
|
||||
return phosg::string_printf("[VectorXZF x=%g z=%g]", this->x.load(), this->z.load());
|
||||
}
|
||||
@@ -73,6 +83,31 @@ struct VectorXYZF {
|
||||
return ((this->x * this->x) + (this->y * this->y) + (this->z * this->z));
|
||||
}
|
||||
|
||||
inline VectorXYZF rotate_x(double angle) const {
|
||||
double s = sin(angle);
|
||||
double c = cos(angle);
|
||||
return VectorXYZF(
|
||||
this->x,
|
||||
this->y * c - this->z * s,
|
||||
this->y * s + this->z * c);
|
||||
}
|
||||
inline VectorXYZF rotate_y(double angle) const {
|
||||
double s = sin(angle);
|
||||
double c = cos(angle);
|
||||
return VectorXYZF(
|
||||
this->x * c + this->z * s,
|
||||
this->y,
|
||||
-this->x * s + this->z * c);
|
||||
}
|
||||
inline VectorXYZF rotate_z(double angle) const {
|
||||
double s = sin(angle);
|
||||
double c = cos(angle);
|
||||
return VectorXYZF(
|
||||
this->x * c - this->y * s,
|
||||
this->x * s + this->y * c,
|
||||
this->z);
|
||||
}
|
||||
|
||||
inline std::string str() const {
|
||||
return phosg::string_printf("[VectorXYZF x=%g y=%g z=%g]", this->x.load(), this->y.load(), this->z.load());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user