29 o <<
"*********" << std::endl;
30 o <<
"a_coord:" << std::endl;
31 o <<
"*********" << std::endl;
32 o <<
"This is a local coordinate system class" << std::endl;
34 o <<
"Create a local coordinate system:" << std::endl;
35 o <<
" a_coord c" << std::endl;
36 o <<
"name _name: give a name to the coordinate system" << std::endl;
37 o <<
"name: get the name of the coordinate system" << std::endl;
38 o <<
"reset: reset to the world coordinate system" << std::endl;
39 o <<
"translate _x _y _z: translate the coordinate system (translation in user coordinate)" << std::endl;
40 o <<
"translateW _x _y _z: translate the coordinate system (translation in world coordinates)" << std::endl;
41 o <<
"scale _x _y _z: scale the coordinate system" << std::endl;
42 o <<
"scale _f: scale the coordinate system" << std::endl;
43 o <<
"rad: set angle unit to radian (default)" << std::endl;
44 o <<
"deg: set angle unit to degrees" << std::endl;
45 o <<
"mode: get the angle mode" << std::endl;
46 o <<
"mode _val: set the angle mode" << std::endl;
47 o <<
"rotateX _val: rotate around local x axis" << std::endl;
48 o <<
"rotateY _val: rotate around local y axis" << std::endl;
49 o <<
"rotateZ _val: rotate around local z axis" << std::endl;
50 o <<
"rotateXW _val: rotate around world x axis" << std::endl;
51 o <<
"rotateYW _val: rotate around world y axis" << std::endl;
52 o <<
"rotateZW _val: rotate around world z axis" << std::endl;
53 o <<
"orient _origin _x _y: place the coordinate system with origin in _origin, x axis along _x and y axis in the plane defined by _x and _y" << std::endl;
54 o <<
"w2l _a_point: convert world to local coordinates" << std::endl;
55 o <<
"l2w _a_point: convert local to world coordinates" << std::endl;
63 for (
int i=0; i<4; i++) (*
this)(i,i) = 1;
68 for (
int i=0; i<4; i++) (*
this)(i,i) = 1;
89 for (
int i=0; i<4; i++)
91 for (
int j=0; j<4; j++)
92 r(i,j) = (*this)(i,j);
100 for (
UI i=0; i<4; i++)
102 for (
UI j=0; j<4; j++)
103 (*
this)(i,j) = r(i,j);
118 for (
int i=0; i<3; i++)
120 for (
int j=0; j<3; j++)
121 (*
this)(i,j) = r(i,j);
129 for (
int i=0; i<3; i++)
137 for (
int i=0; i<3; i++)
150 double t[] = {dx,dy,dz};
151 for (
int i=0; i<3; i++)
153 for (
int j=0; j<3; j++)
154 (*
this)(i,3) -= t[j]*(*
this)(i,j);
160 for (
int i=0; i<3; i++) (*
this)(i,0) /= sx;
161 for (
int i=0; i<3; i++) (*
this)(i,1) /= sy;
162 for (
int i=0; i<3; i++) (*
this)(i,2) /= sz;
180 this->
mat(r*(*
this));
193 this->
mat(r*(*
this));
206 this->
mat(r*(*
this));
219 this->
mat((*
this)*r);
232 this->
mat((*
this)*r);
245 this->
mat((*
this)*r);
267 for (
UI i = 0; i<3; i++) (*
this)(0,i) =
x(i);
268 for (
UI i = 0; i<3; i++) (*
this)(1,i) = y(i);
269 for (
UI i = 0; i<3; i++) (*
this)(2,i) = z(i);
285 for (
UI i = 0; i<3; i++) (*
this)(0,i) =
x[i];
286 for (
UI i = 0; i<3; i++) (*
this)(1,i) = y[i];
287 for (
UI i = 0; i<3; i++) (*
this)(2,i) = z[i];
295 while (strcmp(s.c_str(),
"")==0)
301 std::string::size_type ii=s.find_first_not_of(
" ");
302 std::string::size_type ie=s.find_last_not_of(
" ");
303 name_ = s.substr(ii,ie);
310 o << this->
name() << std::endl;
317 std::string
name = this->
name()+
"-1";
323 out(i,3) -= (*this)(j,i)*(*
this)(j,3);
329 out(i,j)=(*this)(j,i);
343 a_point out(ptn(0),ptn(1),ptn(2));
357 a_point out(ptn(0),ptn(1),ptn(2));
368 for (
UI i = 0; i<3; i++) r0(i) = pt(i);
371 for (
UI i = 0; i < 4; i++)
374 for (
UI j = 0; j < 4; j++)
379 for (
UI j = 0; j < 3; j++) r(j) /= v;
383 else if (pt.
maxi() == 4)
387 for (
UI i = 0; i < 4; i++)
390 for (
UI j = 0; j < 4; j++)
396 for (
UI j = 0; j < 3; j++) r(j) /= v;
a_mat_c operator*(const a_coord &c, const a_mat_c &pt)
a_point cross(const a_point &a, const a_point &b)
static const std::string help()
a coordinate system in the Points&Forces file format
a_point l2w(const a_point &pt) const
convert coordinates from world to local
void mat(a_mat_sq &r) const
virtual void read(std::istream &i)
convert coordinates from local to world
void translate(double, double, double)
reset to the world coordinate system
void R(a_mat_sq &r) const
a_point w2l(const a_point &pt) const
void translateW(double, double, double)
static const std::string help()
void scale(double, double, double)
void orient(const a_mat_c &o, const a_mat_c &x, const a_mat_c &y)
virtual void write(std::ostream &o) const
std::valarray< double > & x() const
a_mat sub_matrix(const UI i, const UI j) const
virtual void read(std::istream &i)
virtual void write(std::ostream &o) const
std::cin getline(buf, 256)