24 #include "SimpleOpt.h"
34 {
OPT_NAME, _T(
"--name"), SO_REQ_SEP },
40 std::cerr <<
"pt2dat:" << std::endl;
41 std::cerr <<
"convert 'x y z' file to a calipous 'dat' file (arch modelling)" << std::endl;
42 std::cerr <<
"syntax: pt2dat [-n name|--name name] [-?|-h|--help] density thickness depth < point_file > dat_file" << std::endl;
43 std::cerr <<
" -n name: give the name to the arch" << std::endl;
44 std::cerr <<
" (default: arch)" << std::endl;
45 std::cerr <<
"author: P.Smars, 2002-2011" << std::endl;
46 std::cerr <<
"version: 2009-03-24" << std::endl;
64 a_point
operator()(
const unsigned int i)
const {
return *(*points_)[i];}
89 a_point x0 = *(*points_)[0];
90 for (
unsigned int i=0; i<this->
n_points(); i++)
92 a_point x = *(*points_)[i];
103 o << c.
name() << std::endl;
106 o <<
"3D" << std::endl;
107 a_point origin = c(0);
110 std::cout << origin << std::endl;
113 o << ax << std::endl;
114 o << ay << std::endl;
115 o <<
"0 0" << std::endl;
117 o << c.
depth() << std::endl;
118 o <<
"AA" << std::endl;
119 for (
unsigned int i=1;i<c.
n_points();i++)
122 a_point d = p-origin;
125 o << x <<
" " << z << std::endl;
127 o << c.
depth() << std::endl;
128 o <<
"AA" << std::endl;
133 int main(
int argc,
char *argv[] )
135 std::string
name(
"arch");
139 if (args.LastError() == SO_SUCCESS)
143 else if (args.OptionId() ==
OPT_NAME)
144 name = args.OptionArg();
149 std::cerr <<
"Invalid argument: " << args.OptionText() << std::endl;
150 return error(args.LastError());
155 if (args.FileCount() != 3)
return error(-2);
156 std::ostringstream o;
157 for (
short k= 0; k < 3; k++) o << args.File(k) <<
" ";
158 std::istringstream i(o.str().c_str());
159 double density, thickness, depth;
160 i >> density >> thickness >> depth;
163 auto points =
new std::vector<a_point *>;
164 for (
unsigned int i = 0; i < npts; i++)
166 auto p =
new a_point;
168 points->push_back(p);
void name(const std::string name)
a_point operator()(const unsigned int i) const
calipous(std::vector< a_point * > *)
friend std::ostream & operator<<(std::ostream &o, const calipous &l)
void thickness(double val)
std::vector< a_point * > * points_
e_point cross(e_point &a, e_point &b)
int main(int argc, char *argv[])
CSimpleOpt::SOption g_rgOptions[]
std::ostream & operator<<(std::ostream &o, const calipous &c)