brace-init in vector math

This commit is contained in:
Martin Michelsen
2025-03-22 00:05:50 -07:00
parent 69edba036e
commit 3e59f9a91e
+7 -7
View File
@@ -41,7 +41,7 @@ struct VectorXZF {
inline VectorXZF rotate_y(double angle) const { inline VectorXZF rotate_y(double angle) const {
double s = sin(angle); double s = sin(angle);
double c = cos(angle); double c = cos(angle);
return VectorXZF(this->x * c - this->z * s, this->x * s + this->z * c); return VectorXZF{this->x * c - this->z * s, this->x * s + this->z * c};
} }
inline std::string str() const { inline std::string str() const {
@@ -86,26 +86,26 @@ struct VectorXYZF {
inline VectorXYZF rotate_x(double angle) const { inline VectorXYZF rotate_x(double angle) const {
double s = sin(angle); double s = sin(angle);
double c = cos(angle); double c = cos(angle);
return VectorXYZF( return VectorXYZF{
this->x, this->x,
this->y * c - this->z * s, this->y * c - this->z * s,
this->y * s + this->z * c); this->y * s + this->z * c};
} }
inline VectorXYZF rotate_y(double angle) const { inline VectorXYZF rotate_y(double angle) const {
double s = sin(angle); double s = sin(angle);
double c = cos(angle); double c = cos(angle);
return VectorXYZF( return VectorXYZF{
this->x * c + this->z * s, this->x * c + this->z * s,
this->y, this->y,
-this->x * s + this->z * c); -this->x * s + this->z * c};
} }
inline VectorXYZF rotate_z(double angle) const { inline VectorXYZF rotate_z(double angle) const {
double s = sin(angle); double s = sin(angle);
double c = cos(angle); double c = cos(angle);
return VectorXYZF( return VectorXYZF{
this->x * c - this->y * s, this->x * c - this->y * s,
this->x * s + this->y * c, this->x * s + this->y * c,
this->z); this->z};
} }
inline std::string str() const { inline std::string str() const {