8 for (
int i = 0; i <= 3; i++)
10 this->vec.push_back(0);
16 this->vec.push_back(X);
17 this->vec.push_back(Y);
18 this->vec.push_back(Z);
19 this->vec.push_back(hc);
24 this->vec = other.
getVec();
29 this->vec = other.getVec();
39 this->vec = other.
getVec();
46 result[0] = (*this)[0] + other[0];
47 result[1] = (*this)[1] + other[1];
48 result[2] = (*this)[2] + other[2];
49 result[3] = (*this)[3];
56 result[0] = (*this)[0] - other[0];
57 result[1] = (*this)[1] - other[1];
58 result[2] = (*this)[2] - other[2];
59 result[3] = (*this)[3];
66 result[0] = (*this)[0] / value;
67 result[1] = (*this)[1] / value;
68 result[2] = (*this)[2] / value;
69 result[3] = (*this)[3];
76 result[0] = (*this)[0] * value;
77 result[1] = (*this)[1] * value;
78 result[2] = (*this)[2] * value;
79 result[3] = (*this)[3];
85 if (index > 3 || index < 0)
89 return this->vec[index];
94 if (index > 3 || index < 0)
98 return this->vec[index];
108 double X = (*this)[0];
109 double Y = (*this)[1];
110 double Z = (*this)[2];
112 return sqrt(X * X + Y * Y + Z * Z);
117 double length = (*this).length();
124 for (
int i = 0; i < 3; ++i)
126 (*this)[i] = (*this)[i] * norm;
135 result[0] = first[1] * second[2] - first[2] * second[1];
136 result[1] = first[2] * second[0] - first[0] * second[2];
137 result[2] = first[0] * second[1] - first[1] * second[0];
145 return first[0] * second[0] + first[1] * second[1] + first[2] * second[2];
164 for (
size_t i = 0; i <= 3; i++)
166 for (
size_t j = 0; j <= 3; j++)
168 result[i] = result[i] + matrix[j][i] * this->vec[j];
176 for (
int i = 0; i < 4; i++)
178 if (round(this->vec[i] * 100) / 100. != round(other[i] * 100) / 100.)
188 for (
int i = 0; i < 4; i++)
190 if (round(this->vec[i] * 100) / 100. != round(other[i] * 100) / 100.)
GVector operator-(const GVector other)
GVector operator/(const double value)
static double angle(GVector first, GVector second)
GVector operator+(const GVector other)
static GVector cross(GVector first, GVector second)
GVector operator*(const double value)
double & operator[](const size_t index)
vector< double > getVec() const
bool operator==(const GVector &other) const
static double scalar(GVector first, GVector second)
GVector & operator=(GVector other)
bool operator!=(const GVector &other) const