90 #define TRANS_X(p) (offset_x + scale*(p[dim_x])) 91 #define TRANS_Y(p) (offset_y - scale*(p[dim_y])) 100 cerr <<
"ann2fig: ERROR------->" << msg <<
"<-------------ERROR\n";
104 cerr <<
"ann2fig: WARNING----->" << msg <<
"<-------------WARNING\n";
114 for (
int i = 0; i <
MAX_DIM; i++) {
156 ann2fig [-upi scale] [-x low_x] [-y low_y]\n\ 157 [-sz size] [-dx dim_x] [-dy dim_y] [-sl dim value]*\n\ 161 -upi scale fig units per inch (default = 1200)\n\ 162 -x low_x x and y offset of upper left corner (inches)\n\ 163 -y low_y ...(default = 1)\n\ 164 -sz size maximum side length of figure (in inches)\n\ 166 -dx dim_x horizontal dimension (default = 0)\n\ 167 -dy dim_y vertical dimension (default = 1)\n\ 168 -sv value default slice value (default = 0)\n\ 169 -sl dim value each such pair defines the value along the\n\ 170 ...given dimension at which to slice. This\n\ 171 ...may be supplied for each dimension except\n\ 172 ...dim_x and dim_y.\n\ 173 -ps pointsize size of points in fig units (def = 10)\n\ 174 file file (input=file.dmp, output=file.fig)\n";
180 for (i = 1; i < argc; i++) {
181 if (!strcmp(argv[i],
"-upi")) {
182 sscanf(argv[++i],
"%lf", &
u_per_in);
184 else if (!strcmp(argv[i],
"-x")) {
185 sscanf(argv[++i],
"%lf", &
in_low_x);
187 else if (!strcmp(argv[i],
"-y")) {
188 sscanf(argv[++i],
"%lf", &
in_low_y);
190 else if (!strcmp(argv[i],
"-sz")) {
191 sscanf(argv[++i],
"%lf", &
in_size);
193 else if (!strcmp(argv[i],
"-dx")) {
194 sscanf(argv[++i],
"%d", &
dim_x);
196 else if (!strcmp(argv[i],
"-dy")) {
197 sscanf(argv[++i],
"%d", &
dim_y);
199 else if (!strcmp(argv[i],
"-sv")) {
200 sscanf(argv[++i],
"%lf", &sl_val);
203 else if (!strcmp(argv[i],
"-sl")) {
204 sscanf(argv[++i],
"%d", &sl_dim);
205 if (sl_dim < 0 || sl_dim >=
MAX_DIM) {
208 sscanf(argv[++i],
"%lf", &
slice_val[sl_dim]);
210 if (!strcmp(argv[i],
"-ps")) {
211 sscanf(argv[++i],
"%i", &
pt_size);
241 for (i = 1; i < argc; i++) {
268 ofile <<
"1 3 0 1 -1 7 0 0 0 0.000 1 0.0000 ";
271 ofile << cent_x <<
" " << cent_y <<
" " 273 << cent_x <<
" " << cent_y <<
" " 280 ofile <<
"2 2 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 5\n";
287 << p0_x <<
" " << p0_y <<
" " 288 << p1_x <<
" " << p0_y <<
" " 289 << p1_x <<
" " << p1_y <<
" " 290 << p0_x <<
" " << p1_y <<
" " 291 << p0_x <<
" " << p0_y <<
"\n";
297 ofile <<
"2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 2\n";
304 << p0_x <<
" " << p0_y <<
" " 305 << p1_x <<
" " << p1_y <<
"\n";
312 if (!strcmp(caption,
"\0"))
return;
315 ofile <<
"4 0 -1 0 0 0 20 0.0000 4 255 2000 ";
316 ofile << px <<
" " << py <<
" " << caption <<
"\\001\n";
334 for (
int i = 0; i <
dim; i++) {
390 if (strcmp(tag,
"leaf") == 0) {
395 for (
int i = 0; i <
n_pts; i++) {
401 for (
int i = 0; i <
n_pts; i++) {
406 else if (strcmp(tag,
"split") == 0) {
408 ifile >> cd >> cv >> lb >> hb;
409 if (lb != box.
lo[cd] || hb != box.
hi[cd]) {
443 else if (strcmp(tag,
"shrink") == 0) {
447 for (
int i = 0; i < n_bnds; i++) {
448 ifile >> cd >> cv >> sd;
522 if (strcmp(str,
"#ANN") != 0) {
527 if (strcmp(str,
"points") == 0) {
531 for (
int i = 0; i <
n_pts; i++) {
534 if (idx < 0 || idx >= n_pts) {
537 for (j = 0; j <
dim; j++) {
543 if (strcmp(str,
"tree") == 0) {
552 for (j = 0; j <
dim; j++) {
555 for (j = 0; j <
dim; j++) {
562 if (box_len_x > box_len_y)
scale =
u_size/box_len_x;
569 else if (strcmp(str,
"null") == 0)
return;
571 cerr <<
"Input string: " << str <<
"\n";
572 Error(
"Illegal ann format. Expecting section heading",
ANNabort);
void Error(const char *msg, ANNerr level)
void project(ANNpoint &q)
void getArgs(int argc, char **argv)
DLL_API ANNpointArray annAllocPts(int n, int dim)
void writePoint(ANNpoint p)
void readTree(ANNorthRect &bnd_box)
void writeBox(const ANNorthRect &r)
void set_slice_val(double val)
ANNbool overlap(const ANNorthRect &box)
char outfile_name[STRING_LEN]
char file_name[STRING_LEN]
char infile_name[STRING_LEN]
void writeLine(ANNpoint p0, ANNpoint p1)
main(int argc, char **argv)
const double DEF_SLICE_VAL
void writeCaption(const ANNorthRect &bnd_box, char *caption)
double slice_val[MAX_DIM]
void recReadTree(ANNorthRect &box)