26 #include "SimpleOpt.h"
34 {
OPT_PREC,_T(
"--precision"), SO_REQ_SEP },
35 {
OPT_ORI,_T(
"-ox"), SO_REQ_SEP },
36 {
OPT_ORI,_T(
"-oy"), SO_REQ_SEP },
37 {
OPT_ORI,_T(
"-oz"), SO_REQ_SEP },
38 {
OPT_REF,_T(
"-px"), SO_REQ_SEP },
39 {
OPT_REF,_T(
"-py"), SO_REQ_SEP },
40 {
OPT_REF,_T(
"-pz"), SO_REQ_SEP },
49 const double pi = 3.14159265358979;
53 #include "orient.help"
57 int main(
int argc,
char *argv[] )
59 std::string code(
"x");
61 a_point ori(0.,0.,0.);
64 bool with_matrix =
false;
68 if (args.LastError() == SO_SUCCESS)
72 else if (args.OptionId() ==
OPT_DIR)
74 std::string code0(args.OptionText());
75 code = code0.substr(1,1);
77 else if (args.OptionId() ==
OPT_ORI)
80 o << args.OptionArg();
81 std::istringstream
in(o.str().c_str());
84 std::string
dir(args.OptionText());
85 if (
dir ==
"-ox") ori.x(val);
86 else if (
dir ==
"-oy") ori.y(val);
87 else if (
dir ==
"-oz") ori.z(val);
89 else if (args.OptionId() ==
OPT_REF)
92 o << args.OptionArg();
93 std::istringstream
in(o.str().c_str());
96 std::string
dir(args.OptionText());
97 if (
dir ==
"-px") p.x(val);
98 else if (
dir ==
"-py") p.y(val);
99 else if (
dir ==
"-pz") p.z(val);
101 else if (args.OptionId() ==
OPT_PREC)
103 std::ostringstream o;
104 o << args.OptionArg();
105 std::istringstream
in(o.str().c_str());
108 if ((prec >= 0)&&(prec < 14))
113 std::ifstream
in(args.OptionArg());
116 std::cerr <<
"cannot open file: '" << args.OptionArg() <<
"'" << std::endl;
124 std::cerr <<
"The matrix should be 4x4! Take a look to the manual page." << std::endl << std::endl;
133 std::cerr <<
"Invalid argument: " << args.OptionText() << std::endl;
134 return error(args.LastError());
141 a_point nref = p-ori;
158 std::cout << npts << std::endl;
159 std::cout << std::fixed << std::setprecision(
pre);
160 for (
unsigned int k = 0; k < npts; k++)
168 std::cin >> x0(0) >> x0(1) >> x0(2);
171 std::cout << x(0)/x(3) <<
" " << x(1)/x(3) <<
" " << x(2)/x(3) << std::endl;
174 std::cerr <<
"point projected to infinity! Inspect output before use!!" << std::endl;
175 std::cout << x(0) <<
" " << x(1) <<
" " << x(2) <<
" " << x(3) <<
" inf" << std::endl;
182 x.rotate(nx,ny,nz).translate(ori.x(),ori.y(),ori.z());
183 std::cout << x << std::endl;
e_point cross(e_point &a, e_point &b)
int main(int argc, char *argv[])
CSimpleOpt::SOption g_rgOptions[]
a_point dir(int i, int l)