27 int TVector::numberInstance = 0;
29 int TVector::generateId() {
30 return TVector::numberInstance++;
43 TVector::TVector(
double xx1,
double xx2,
double xx3) {
56 coors[ 0 ] = P2.
X() - P1.
X();
57 coors[ 1 ] = P2.
Y() - P1.
Y();
58 coors[ 2 ] = P2.
Z() - P1.
Z();
78 void TVector::Compute() {
82 void TVector::CompLength() {
83 length = sqrt(pow(this->coors[ 0 ], 2.0) + pow(this->coors[ 1 ], 2.0) + pow(this->coors[ 2 ], 2.0));
87 this->coors[ 0 ] = P.
X();
88 this->coors[ 1 ] = P.
Y();
89 this->coors[ 2 ] = P.
Z();
99 for (
int i = 0; i < 3; i++) {
111 for (
int i = 0; i < 3; i++) {
112 res.
coors[ i ] = coors[i] + P.
Get(i + 1);
123 for (
int i = 0; i < 3; i++) {
132 void TVector::SetVector(
double xx1,
double xx2,
double xx3) {
163 void TVector::Get(
double &xx1,
double &xx2,
double &xx3)
const {
170 void TVector::Get(
double *U)
const {
171 for (
int i = 0; i < 3; i++) {
178 double TVector::Get(
int i)
const {
179 return coors[ i - 1 ];
190 x1 = u2 * v3 - u3 * v2;
191 x2 = u3 * v1 - u1 * v3;
192 x3 = u1 * v2 - u2 * v1;
206 double product = u1 * v1 + u2 * v2 + u3 * v3;
212 for (
int i = 0; i < 3; i++) {
213 if ((fabs(coors[ i ]) - fabs(U.
coors[ i ])) >
epsilon) {
220 double TVector::X1()
const {
224 double TVector::X2()
const {
228 double TVector::X3()
const {
void Get(double &, double &, double &) const
void SetVector(double, double, double)
bool operator==(const Null &, const Null &)
bool AreParallel(const TVector &, const TVector &)
double Dot(const TVector &, const TVector &)
bool ArePerpendicular(const TVector &, const TVector &)
TVector operator*(double x, const TVector &U)
TVector Cross(const TVector &, const TVector &)