21 return (this->x == p2.x && this->y == p2.y && this->z == p2.z);
25 return !(*
this == p2);
28 float length()
const {
29 return (
float)sqrtf(x * x + y * y + z * z);
32 float operator[](
int index) {
33 float arr[3] = {x, y, z};
39 p.x = this->x + pnt.x;
40 p.y = this->y + pnt.y;
41 p.z = this->z + pnt.z;
55 p.x = this->x * pnt.x;
56 p.y = this->y * pnt.y;
57 p.z = this->z * pnt.z;
63 p.x = this->x - pnt.x;
64 p.y = this->y - pnt.y;
65 p.z = this->z - pnt.z;
70 return {this->x / f, this->y / f, this->z / f};
74 return {-this->x, -this->y, -this->z};
79 float a = (float)(angle * DEG_TO_RAD);
82 float cosb = 1.0f - cosa;
85 float nx = this->x * (ax.x * ax.x * cosb + cosa) + this->y * (ax.x * ax.y * cosb - ax.z * sina) + this->z * (ax.x * ax.z * cosb + ax.y * sina);
86 float ny = this->x * (ax.y * ax.x * cosb + ax.z * sina) + this->y * (ax.y * ax.y * cosb + cosa) + this->z * (ax.y * ax.z * cosb - ax.x * sina);
87 float nz = this->x * (ax.z * ax.x * cosb - ax.y * sina) + this->y * (ax.z * ax.y * cosb + ax.x * sina) + this->z * (ax.z * ax.z * cosb + cosa);
96 float length = (float)sqrtf(this->x * this->x + this->y * this->y + this->z * this->z);
108 float length = (float)sqrtf(x * x + y * y + z * z);
111 p.x = this->x / length;
112 p.y = this->y / length;
113 p.z = this->z / length;
126 float a = (float)(angle * DEG_TO_RAD);
127 float sina = sinf(a);
128 float cosa = cosf(a);
129 float cosb = 1.0f - cosa;
132 p.x = this->x * (ax.x * ax.x * cosb + cosa) + this->y * (ax.x * ax.y * cosb - ax.z * sina) + this->z * (ax.x * ax.z * cosb + ax.y * sina);
133 p.y = this->x * (ax.y * ax.x * cosb + ax.z * sina) + this->y * (ax.y * ax.y * cosb + cosa) + this->z * (ax.y * ax.z * cosb - ax.x * sina);
134 p.z = this->x * (ax.z * ax.x * cosb - ax.y * sina) + this->y * (ax.z * ax.y * cosb + ax.x * sina) + this->z * (ax.z * ax.z * cosb + cosa);
140 p.x = this->y * b.z - this->z * b.y;
141 p.y = this->z * b.x - this->x * b.z;
142 p.z = this->x * b.y - this->y * b.x;
147 return vec1.x * vec2.x + vec1.y * vec2.y + vec1.z * vec2.z;
151 return sqrt(powf(vec1.x - vec2.x, 2) + powf(vec1.y - vec2.y, 2) + powf(vec1.z - vec2.z, 2));
168 Mach1Point3D Mach1Point3D_create(
float X,
float Y,
float Z) {