40 double dlg = this->
Len();
58 y = yy*cos(alfa) - zz*sin(alfa);
59 z = yy*sin(alfa) + zz*cos(alfa);
66 x = zz*sin(alfa) + xx*cos(alfa);
67 z = zz*cos(alfa) - xx*sin(alfa);
74 x = xx*cos(alfa) - yy*sin(alfa);
75 y = xx*sin(alfa) + yy*cos(alfa);
110 y = yy*cos(alfa) - zz*sin(alfa);
111 z = yy*sin(alfa) + zz*cos(alfa);
150 x = zz*sin(alfa) + (xx-dX)*cos(alfa) + dX;
151 z = zz*cos(alfa) - (xx-dX)*sin(alfa);
190 x = xx*cos(alfa) - yy*sin(alfa);
191 y = xx*sin(alfa) + yy*cos(alfa);
204 return ( A.
x * B.
x + A.
y * B.
y + A.
z * B.
z );
213 c.
x = A.
y * B.
z - A.
z * B.
y;
214 c.
y = A.
z * B.
x - A.
x * B.
z;
215 c.
z = A.
x * B.
y - A.
y * B.
x;
307 tmp.
x = A.
y * B.
z - A.
z * B.
y;
308 tmp.
y = A.
z * B.
x - A.
x * B.
z;
309 tmp.
z = A.
x * B.
y - A.
y * B.
x;
355 return ( A.
x == B.
x && A.
y == B.
y && A.
z == B.
z );
389 printf(
"%s=[%19.11f,%19.11f,%19.11f]\n", name , vec.
x , vec.
y , vec.
z );
392void v_printf(
char *fmt ,
char *name ,
const VECTOR_3D &vec )
394 printf( fmt , name , vec.
x , vec.
y , vec.
z );
397void v_sprintf(
char *dest ,
char *name ,
const VECTOR_3D &vec )
399 sprintf(dest,
"%s=[%19.11f,%19.11f %19.11f]", name , vec.
x , vec.
y , vec.
z );
402void v_sprintf(
char *dest ,
char *fmt ,
char *name ,
const VECTOR_3D &vec )
404 sprintf(dest , fmt , name , vec.
x , vec.
y , vec.
z );
407void v_fprintf( FILE *dest ,
char *name ,
const VECTOR_3D &vec )
409 fprintf(dest,
"%s=[%19.11f,%19.11f %19.11f]\n", name , vec.
x , vec.
y , vec.
z );
412void v_fprintf( FILE *dest ,
char *fmt ,
char *name ,
const VECTOR_3D &vec )
414 fprintf( dest , fmt , name , vec.
x , vec.
y , vec.
z );
417ostream& operator << ( ostream & out,
const VECTOR_3D & vec )
419 out <<
"[" << vec.
x <<
" , " << vec.
y <<
" , " << vec.
z <<
"]";
427 fprintf (ff,
"% 12.7f % 12.7f % 12.7f",vec.
x,vec.
y,vec.
z);
434 fprintf (ff,
"% 12.7f % 12.7f % 12.7f",vec.
x,-vec.
y,vec.
z);
441 fprintf (ff,
"% 12.7f % 12.7f % 12.7f",vec.
x,0.,vec.
z);
Vector 3D class - vector manipulation.
void rotX(double alpha)
Rotating functions rotates the vector relative to the X axis by an alpha[rad] angle
void rotY(double alpha)
rotates the vector relative to the Y axis by an alpha[rad] angle
VECTOR_3D & operator=(const VECTOR_3D &v)
assignment operator
double Len(void) const
the value of the vector
void rotdZ(double alfa)
rotates the vector relative to the Z axis by an alpha[deg] angle (precise values for 0,...
void rotZ(double alpha)
rotates the vector relative to the Z axis by an alpha[rad] angle
void rotdY(double alfa, double dX=0.)
rotates the vector relative to the Y axis (shifted by dX longwise X) by an alpha[deg] angle (precise ...
void rotdX(double alfa)
rotates the vector relative to the X axis by an alpha[deg] angle (precise values for 0,...
double Normalize(void)
normalizes the vector to unit - coordiantes are divided by the vector value, returnes the vector valu...
Vector 3D class and functions.