diff --git a/arc_arc_arc.cc b/arc_arc_arc.cc index 20967d2..37ba06b 100644 --- a/arc_arc_arc.cc +++ b/arc_arc_arc.cc @@ -49,7 +49,7 @@ vr_bool vroniObject::ArcArcArcCntr(int i, int j, int k, int e, coord* cntr, double *r2, vr_bool *problematic, int *site) { - int t, m, n, best_sol, n1; + int t, m, n, best_sol = 0, n1; coord c1, c2, c3; double rr1, rr2, rr3, rad; coord centers[VRONI_MAXSOL]; @@ -571,7 +571,6 @@ vr_bool vroniObject::ArcArcArcCntr(int i, int j, int k, int e, if ( rr1 < rr2 ) { coord tmpc; double tmpd; - int tmpi; VroniSwap(c1,c2, tmpc); VroniSwap(rr1,rr2, tmpd); VroniSwap(i,j, tmpi); @@ -579,7 +578,6 @@ vr_bool vroniObject::ArcArcArcCntr(int i, int j, int k, int e, if ( rr1 < rr3 ) { coord tmpc; double tmpd; - int tmpi; VroniSwap(c1,c3, tmpc); VroniSwap(rr1,rr3, tmpd); VroniSwap(i,k, tmpi); @@ -587,7 +585,6 @@ vr_bool vroniObject::ArcArcArcCntr(int i, int j, int k, int e, if ( rr2 < rr3 ) { coord tmpc; double tmpd; - int tmpi; VroniSwap(c2,c3, tmpc); VroniSwap(rr2,rr3, tmpd); VroniSwap(j,k, tmpi); diff --git a/arc_common.cc b/arc_common.cc index c6c726d..83647fc 100644 --- a/arc_common.cc +++ b/arc_common.cc @@ -625,8 +625,6 @@ int vroniObject::IntersectTwoCircles( const coord & c1, const coord & c2, return 2; } - - return -1; } diff --git a/arg_eval.cc b/arg_eval.cc index c4272c7..3b82da7 100644 --- a/arg_eval.cc +++ b/arg_eval.cc @@ -74,7 +74,10 @@ vr_bool vroniObject::ArgEval(int argc, char *argv[], vr_bool *color_graphics, double *vd_apx_dist, vr_bool *left_vd, vr_bool *right_vd, vr_bool *vr_incr, char *vr_file, - int *inputprec, int *mpfr_prec, int *seed) + int *inputprec, int *mpfr_prec, int *seed, + vr_bool *compute_path, double *tool_rad, + double *angle, double *step_over, + vr_bool *write_path, char *path_file) { int count = 1; vr_bool success = true; @@ -143,11 +146,17 @@ vr_bool vroniObject::ArgEval(int argc, char *argv[], vr_bool *color_graphics, *vd_apx_dist = 0.0; *inputprec = -1; *mpfr_prec = 23; + *compute_path = false; + *tool_rad = 0.0; + *angle = 360.0; + *step_over = 0.0; + *write_path = false; strcpy(vd_file, ""); strcpy(vd_dt_file, ""); strcpy(output_file, ""); strcpy(input_file, ""); strcpy(vr_file, ""); + strcpy(path_file, ""); /* */ /* parse the command-line arguments */ @@ -168,11 +177,10 @@ vr_bool vroniObject::ArgEval(int argc, char *argv[], vr_bool *color_graphics, } else if (strcmp(argv[count],"--b+w") == 0) { *color_graphics = false; - } - else if (strcmp(argv[count],"--OGL") == 0) { + } #ifdef GRAPHICS + else if (strcmp(argv[count],"--OGL") == 0) { *graphics = true; -#endif } else if (strcmp(argv[count],"--Ipe") == 0) { if(! *save_data) { @@ -181,6 +189,7 @@ vr_bool vroniObject::ArgEval(int argc, char *argv[], vr_bool *color_graphics, if ((success = (count < argc))) strcpy(output_file, argv[count]); } } +#endif else if (strcmp(argv[count],"--seed") == 0) { ++count; if ((success = (count < argc))) *seed = atoi(argv[count]); @@ -234,9 +243,12 @@ vr_bool vroniObject::ArgEval(int argc, char *argv[], vr_bool *color_graphics, else if (strcmp(argv[count],"--auto_offset") == 0) { *auto_offset = true; } +#ifdef MAT else if (strcmp(argv[count],"--wmat") == 0) { *compute_wmat = true; } +#endif +#ifdef WMAT else if (strcmp(argv[count],"--auto_wmat") == 0) { *auto_wmat = true; *compute_wmat = true; @@ -253,6 +265,7 @@ vr_bool vroniObject::ArgEval(int argc, char *argv[], vr_bool *color_graphics, if (*wmat_dist < 0.0) *wmat_dist = 0.0; *compute_wmat = true; } +#endif else if (strcmp(argv[count],"--left_offset") == 0) { *left_offset = true; } @@ -426,6 +439,28 @@ vr_bool vroniObject::ArgEval(int argc, char *argv[], vr_bool *color_graphics, else if (strcmp(argv[count],"--cgal") == 0) { cgal = true; } +#endif +#ifdef HSM + else if (strcmp(argv[count],"--mathsm") == 0) { + *compute_path = true; + } + else if (strcmp(argv[count],"--radius") == 0) { + ++count; + if ((success = (count < argc))) *tool_rad = atof(argv[count]); + } + else if (strcmp(argv[count],"--step_over") == 0) { + ++count; + if ((success = (count < argc))) *step_over = atof(argv[count]); + } + else if (strcmp(argv[count],"--angle") == 0) { + ++count; + if ((success = (count < argc))) *angle = atof(argv[count]); + } + else if (strcmp(argv[count],"--path_dxf") == 0) { + *write_path = true; + ++count; + if ((success = (count < argc))) strcpy(path_file, argv[count]); + } #endif else { /* */ @@ -486,20 +521,28 @@ void vroniObject::EvalError(void) " [--ostep NNN]\n"); fprintf(stderr, " [--astep NNN] [--Ipe XXX] [--full] [--clean]\n"); +#elif defined(GRAPHICS) +fprintf(stderr, + " [--Ipe XXX]\n"); #endif - /* - fprintf(stderr, - " [--approx NNN]\n"); - */ - fprintf(stderr, - " [--auto_offset] [--offset FFF] [--doffset FFF] [--off XXX]\n"); - fprintf(stderr, - " [--off_dxf XXX] [--left_offset] [--right_offset] [--mic]\n"); +/* +fprintf(stderr, +" [--approx NNN]\n"); +*/ +fprintf(stderr, + " [--mic] [--auto_offset] [--offset FFF] [--doffset FFF]\n"); +fprintf(stderr, + " [--off XXX | --off_dxf XXX] [--left_offset] [--right_offset]\n"); +#ifdef MAT #ifdef WMAT - fprintf(stderr, - " [--wmat] [--wmat_angle FFF] [--wmat_dist FFF]"); - fprintf(stderr, - " [--auto_wmat]\n"); +fprintf(stderr, + " [--wmat] [--wmat_angle FFF] [--wmat_dist FFF]"); +fprintf(stderr, + " [--auto_wmat]\n"); +#else +fprintf(stderr, + " [--wmat]\n"); +#endif #endif #ifdef WRITE_VD fprintf(stderr, @@ -524,6 +567,12 @@ void vroniObject::EvalError(void) fprintf(stderr, " [--inputprec NNN]\n"); #endif +#ifdef HSM + fprintf(stderr, + " [--mathsm] [--radius FFF] [--step_over FFF] [--angle FFF]\n"); + fprintf(stderr, + " [--path_dxf XXX]\n"); +#endif /* */ /* let the user call some application-specific function */ @@ -637,18 +686,21 @@ void vroniObject::EvalError(void) fprintf(stderr, "--mic: compute the maximum inscribed/empty circle.\n"); #ifdef MAT - fprintf(stderr, - "--wmat: compute (weighted) medial axis\n"); -#endif #ifdef WMAT fprintf(stderr, - "--wmat_angle a: angle threshold for WMAT computation\n"); + "--wmat: compute (weighted) medial axis\n"); fprintf(stderr, - "--wmat_dist d: distance threshold for WMAT computation\n"); + "--wmat_angle a: angle threshold for WMAT computation\n"); fprintf(stderr, - "--auto_wmat: compute WMAT according to `nice' thresholds\n"); + "--wmat_dist d: distance threshold for WMAT computation\n"); fprintf(stderr, - " automatically determined by the program\n"); + "--auto_wmat: compute WMAT according to `nice' thresholds\n"); + fprintf(stderr, + " automatically determined by the program\n"); +#else + fprintf(stderr, + "--wmat: compute medial axis\n"); +#endif #endif fprintf(stderr, "--file XXX: read input data from file `XXX'; the appropriate input\n"); @@ -689,7 +741,19 @@ void vroniObject::EvalError(void) fprintf(stderr, "--clean: clean up the data by looking for intersections prior to\n"); fprintf(stderr, - " the VD computation.\n"); + " the VD computation\n"); +#ifdef HSM + fprintf(stderr, + "--mathsm: compute MATHSM path\n"); + fprintf(stderr, + "--radius FFF: tool radius\n"); + fprintf(stderr, + "--step_over FFF: maximum step-over distance\n"); + fprintf(stderr, + "--angle FFF: maximum engagement angle\n"); + fprintf(stderr, + "--path_dxf XXX: output file for tool path; path is written in .dxf format\n"); +#endif /* */ /* let the user call some application-specific function */ diff --git a/driver.cc b/driver.cc index 6979cb3..63891b5 100644 --- a/driver.cc +++ b/driver.cc @@ -77,7 +77,7 @@ void vroniObject::ProceedWithoutGraphics(vr_bool new_data) { #ifdef MIC coord center; - double radius; + double rad; #endif if (!new_data) return; @@ -126,12 +126,18 @@ void vroniObject::ProceedWithoutGraphics(vr_bool new_data) /* */ #ifdef MIC if (compute_mic && !pnts_only) - API_ComputeOutputMIC(time_it, left_offset, right_offset, ¢er, - &radius); - center.x = center.y = radius = 0.0; /* avoid compiler complaints since */ + API_ComputeOutputMIC(time_it, left_offset, right_offset, ¢er, &rad); + center.x = center.y = rad = 0.0; /* avoid compiler complaints since */ /* we don't use those variables... */ #endif +#ifdef HSM + if (compute_path) { + ComputePath(time_it, path_file, write_path, dxf_format, tool_rad, + step_over, angle); + } +#endif + return; } @@ -157,7 +163,9 @@ void vroniObject::ParseCommandLineArgs(int argc, char *argv[], &check_data, &write_vd_dt, vd_dt_file, &read_pnts, &dxf_format, &read_file, &write_ma, ma_file, &clean_up, &write_vd, vd_file, &vd_apx_dist, &left_vd, &right_vd, - &vr_incr, vr_file, &inputprec, &mpfr_prec, &vr_seed)) { + &vr_incr, vr_file, &inputprec, &mpfr_prec, &vr_seed, + &compute_path, &tool_rad, &angle, &step_over, + &write_path, path_file)) { Copyright(); EvalError(); throw std::runtime_error("VRONI error: ArgEval() - unrecognized CL option!"); @@ -228,18 +236,6 @@ void vroniObject::GetInputData(vr_bool *input_read) } -#ifdef WRITE_VD - -void vroniObject::HandleWriteVDOutput(void) -{ - if (write_vd) - API_Output_VD(vd_file, vd_apx_dist, left_vd, right_vd); - - return; -} -#endif /* WRITE_VD */ - - #ifdef OGL_GRAPHICS @@ -249,7 +245,7 @@ void vroniObject::HandleComputeVD(void) vr_bool dummy_draw_pnts; #ifdef MIC coord center; - double radius; + double rad; #endif if (!computed) { @@ -335,17 +331,27 @@ void vroniObject::HandleComputeVD(void) } } #endif +#ifdef MIC if (computed && finished && !mic_computed && !pnts_only) { if (compute_mic) { -#ifdef MIC draw_mic = true; - ComputeMIC(time_it, left_offset, right_offset, ¢er, &radius); - center.x = center.y = radius = 0.0; /* avoid GCC complaints ...*/ + ComputeMIC(time_it, left_offset, right_offset, ¢er, &rad); + center.x = center.y = rad = 0.0; /* avoid GCC complaints ...*/ mic_computed = true; -#endif } } - if (computed && finished && !quiet && off_finished) { +#endif +#ifdef HSM + if (computed && finished && !path_computed) { + if (compute_path) { + ComputePath(time_it, path_file, write_path, dxf_format, tool_rad, + step_over, angle); + path_computed = true; + } + } +#endif + + if (computed && finished && !quiet && (off_finished || path_computed)) { /* */ /* hey, let's ring the bell */ /* */ diff --git a/ext_appl_defs.cc b/ext_appl_defs.cc index e170727..84dffd0 100644 --- a/ext_appl_defs.cc +++ b/ext_appl_defs.cc @@ -54,6 +54,12 @@ const eam_type eam_NIL = -1; #define eam_NIL -1 #endif +#ifdef EXT_APPL_PATH +const eao_type eah_NIL = -1; +#else +#define eah_NIL -1 +#endif + diff --git a/ext_appl_path.cc b/ext_appl_path.cc new file mode 100644 index 0000000..fee678f --- /dev/null +++ b/ext_appl_path.cc @@ -0,0 +1,4 @@ +/* */ +/* this file is reserved for application-specific routines that need to */ +/* access my HSM path data structures */ +/* */ diff --git a/io_debug.cc b/io_debug.cc index 2428b77..a02d953 100644 --- a/io_debug.cc +++ b/io_debug.cc @@ -169,8 +169,8 @@ void vroniObject::WriteProcessedSites(const char *output_file) #define ClipSeg(x1, y1, x2, y2) \ -((Min(x1, x2) <= clip_max.x) && (Max(x1, x2) >= clip_min.x) && \ - (Min(y1, y2) <= clip_max.y) && (Max(y1, y2) >= clip_min.y)) +((VroniMin(x1, x2) <= clip_max.x) && (VroniMax(x1, x2) >= clip_min.x) && \ + (VroniMin(y1, y2) <= clip_max.y) && (VroniMax(y1, y2) >= clip_min.y)) diff --git a/ipe_io.cc b/ipe_io.cc index 1f2b258..e04a699 100644 --- a/ipe_io.cc +++ b/ipe_io.cc @@ -56,9 +56,9 @@ FILE *InitIpeFile(char *filename) FILE *ipe_file; if ((ipe_file = fopen(filename, "w")) != NULL) { - fprintf(ipe_file, "\n\n\n\n\n\n\n0 0 m\n-1 0.333 l\n-1 -0.333 l\nh\n\n\n\n\n0 0 m\n-1 0.333 l\n-1 -0.333 l\nh\n\n\n\n\n0 0 m\n-1 0.333 l\n-0.8 0 l\n-1 -0.333 l\nh\n\n\n\n\n0 0 m\n-1 0.333 l\n-0.8 0 l\n-1 -0.333 l\nh\n\n\n\n\n0.6 0 0 0.6 0 0 e\n0.4 0 0 0.4 0 0 e\n\n\n\n\n0.6 0 0 0.6 0 0 e\n\n\n\n\n\n0.5 0 0 0.5 0 0 e\n\n\n0.6 0 0 0.6 0 0 e\n0.4 0 0 0.4 0 0 e\n\n\n\n\n\n-0.6 -0.6 m\n0.6 -0.6 l\n0.6 0.6 l\n-0.6 0.6 l\nh\n-0.4 -0.4 m\n0.4 -0.4 l\n0.4 0.4 l\n-0.4 0.4 l\nh\n\n\n\n\n-0.6 -0.6 m\n0.6 -0.6 l\n0.6 0.6 l\n-0.6 0.6 l\nh\n\n\n\n\n\n-0.5 -0.5 m\n0.5 -0.5 l\n0.5 0.5 l\n-0.5 0.5 l\nh\n\n\n-0.6 -0.6 m\n0.6 -0.6 l\n0.6 0.6 l\n-0.6 0.6 l\nh\n-0.4 -0.4 m\n0.4 -0.4 l\n0.4 0.4 l\n-0.4 0.4 l\nh\n\n\n\n\n\n\n-0.43 -0.57 m\n0.57 0.43 l\n0.43 0.57 l\n-0.57 -0.43 l\nh\n\n\n-0.43 0.57 m\n0.57 -0.43 l\n0.43 -0.57 l\n-0.57 0.43 l\nh\n\n\n\n\n\n0 0 m\n-1 0.333 l\n-1 -0.333 l\nh\n\n\n\n\n0 0 m\n-1 0.333 l\n-0.8 0 l\n-1 -0.333 l\nh\n\n\n\n\n0 0 m\n-1 0.333 l\n-0.8 0 l\n-1 -0.333 l\nh\n\n\n\n\n-1 0.333 m\n0 0 l\n-1 -0.333 l\n\n\n\n\n0 0 m\n-1 0.333 l\n-1 -0.333 l\nh\n-1 0 m\n-2 0.333 l\n-2 -0.333 l\nh\n\n\n\n\n0 0 m\n-1 0.333 l\n-1 -0.333 l\nh\n-1 0 m\n-2 0.333 l\n-2 -0.333 l\nh\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"); + fprintf(ipe_file, "\n\n\n\n\n\n\n0 0 m\n-1 0.333 l\n-1 -0.333 l\nh\n\n\n\n\n0 0 m\n-1 0.333 l\n-1 -0.333 l\nh\n\n\n\n\n0 0 m\n-1 0.333 l\n-0.8 0 l\n-1 -0.333 l\nh\n\n\n\n\n0 0 m\n-1 0.333 l\n-0.8 0 l\n-1 -0.333 l\nh\n\n\n\n\n0.6 0 0 0.6 0 0 e\n0.4 0 0 0.4 0 0 e\n\n\n\n\n0.6 0 0 0.6 0 0 e\n\n\n\n\n\n0.5 0 0 0.5 0 0 e\n\n\n0.6 0 0 0.6 0 0 e\n0.4 0 0 0.4 0 0 e\n\n\n\n\n\n-0.6 -0.6 m\n0.6 -0.6 l\n0.6 0.6 l\n-0.6 0.6 l\nh\n-0.4 -0.4 m\n0.4 -0.4 l\n0.4 0.4 l\n-0.4 0.4 l\nh\n\n\n\n\n-0.6 -0.6 m\n0.6 -0.6 l\n0.6 0.6 l\n-0.6 0.6 l\nh\n\n\n\n\n\n-0.5 -0.5 m\n0.5 -0.5 l\n0.5 0.5 l\n-0.5 0.5 l\nh\n\n\n-0.6 -0.6 m\n0.6 -0.6 l\n0.6 0.6 l\n-0.6 0.6 l\nh\n-0.4 -0.4 m\n0.4 -0.4 l\n0.4 0.4 l\n-0.4 0.4 l\nh\n\n\n\n\n\n\n-0.43 -0.57 m\n0.57 0.43 l\n0.43 0.57 l\n-0.57 -0.43 l\nh\n\n\n-0.43 0.57 m\n0.57 -0.43 l\n0.43 -0.57 l\n-0.57 0.43 l\nh\n\n\n\n\n\n0 0 m\n-1 0.333 l\n-1 -0.333 l\nh\n\n\n\n\n0 0 m\n-1 0.333 l\n-0.8 0 l\n-1 -0.333 l\nh\n\n\n\n\n0 0 m\n-1 0.333 l\n-0.8 0 l\n-1 -0.333 l\nh\n\n\n\n\n-1 0.333 m\n0 0 l\n-1 -0.333 l\n\n\n\n\n0 0 m\n-1 0.333 l\n-1 -0.333 l\nh\n-1 0 m\n-2 0.333 l\n-2 -0.333 l\nh\n\n\n\n\n0 0 m\n-1 0.333 l\n-1 -0.333 l\nh\n-1 0 m\n-2 0.333 l\n-2 -0.333 l\nh\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"); fprintf(ipe_file, - "\n"); + "\n"); fprintf(ipe_file, "\n"); fprintf(ipe_file, "\n", LAYER0); fprintf(ipe_file, "\n", LAYER1); @@ -68,8 +68,9 @@ FILE *InitIpeFile(char *filename) fprintf(ipe_file, "\n", LAYER5); fprintf(ipe_file, "\n", LAYER6); fprintf(ipe_file, "\n", LAYER7); - fprintf(ipe_file, "\n", - LAYER0, LAYER1, LAYER2, LAYER3, LAYER4, LAYER5, LAYER6, LAYER7, LAYER0); + fprintf(ipe_file, "\n", LAYER8); + fprintf(ipe_file, "\n", + LAYER0, LAYER1, LAYER2, LAYER3, LAYER4, LAYER5, LAYER6, LAYER7, LAYER8, LAYER0); } else { throw std::runtime_error("VRONI error: InitIpeFile() - Ipe output file not opened!"); @@ -144,6 +145,11 @@ void WriteBeginGroup(FILE *ipe_file, short int layer) strncpy(color, COLOR7, 1023); strncpy(width, PEN7, 1023); break; + case 8: + strncpy(layername, LAYER8, 1023); + strncpy(color, COLOR8, 1023); + strncpy(width, PEN8, 1023); + break; default: strncpy(layername, LAYER5, 1023); strncpy(color, COLOR5, 1023); @@ -162,8 +168,7 @@ void WriteBeginGroup(FILE *ipe_file, short int layer) void WriteBeginPath(FILE *ipe_file, double x1, double y1) { - - if(newgroup) { + if (newgroup) { newpath = true; newgroup = false; } @@ -171,7 +176,7 @@ void WriteBeginPath(FILE *ipe_file, double x1, double y1) newpath = !((oldX==REAL_TO_FLOAT(x1)) && (oldY==REAL_TO_FLOAT(y1))); } - if(newpath) { + if (newpath) { if (openpath) fprintf(ipe_file,"\n"); FP_fprintf(ipe_file, "\n", color, width); FP_fprintf(ipe_file,"%f %f m\n", @@ -342,3 +347,18 @@ void WriteCircularArc(FILE *ipe_file, double_arg xc, double_arg yc, return; } + + +void WriteCircle(FILE *ipe_file, double_arg xc, double_arg yc, double_arg rad) +{ + if (newgroup) newgroup = false; + if (openpath) fprintf(ipe_file,"\n"); + + FP_fprintf(ipe_file, "\n", color, width); + FP_fprintf(ipe_file,"%f 0 0 %f %f %f e\n", + FP_PRNTARG(rad) * scale, FP_PRNTARG(rad) * scale, + FP_PRNTARG(scaleX(xc)), FP_PRNTARG(scaleY(yc))); + openpath = true; + + return; +} diff --git a/offset.cc b/offset.cc index 70ddc8c..c7e5f1d 100644 --- a/offset.cc +++ b/offset.cc @@ -996,7 +996,7 @@ void vroniObject::apiOutputOffsets(void *output, /* */ /* not exactly an offset type that the code should have assigned */ /* */ - VD_Warning("WriteOffsets() - unknown site type!\n"); + VD_Warning("apiOutputOffsets() - unknown site type!\n"); assert(0 == 1); } } diff --git a/prepro.cc b/prepro.cc index 921670a..6df4992 100644 --- a/prepro.cc +++ b/prepro.cc @@ -786,16 +786,13 @@ void vroniObject::ComputeBulge(const coord & p1, const coord & p2, void vroniObject::ReplaceArc(int i) { -#ifdef EXT_APPL_SITES - eas_type ext_appl; -#endif int i1, i2; i1 = Get1stVtx(i, ARC); i2 = Get2ndVtx(i, ARC); #ifdef EXT_APPL_SITES - if (GetArcOrientation(i)) StoreSeg(i1, i2, ext_appl); - else StoreSeg(i2, i1, ext_appl); + if (GetArcOrientation(i)) StoreSeg(i1, i2, GetExtApplArc(i)); + else StoreSeg(i2, i1, GetExtApplArc(i)); #else if (GetArcOrientation(i)) StoreSeg(i1, i2); else StoreSeg(i2, i1); diff --git a/redraw.cc b/redraw.cc index 292a244..225e03f 100644 --- a/redraw.cc +++ b/redraw.cc @@ -237,6 +237,20 @@ void vroniObject::AddCirToBuffer(coord cntr, double_arg radius) } +void vroniObject::AddDskToBuffer(coord cntr, double_arg radius) +{ + if (num_dsk_buf >= max_num_dsk_buf) { + max_num_dsk_buf += PAGE_SIZE; + gentlyResizeSTLVector(dsk_buf, max_num_dsk_buf, "redraw:dsk_buf"); + } + dsk_buf[num_dsk_buf].cntr = cntr; + dsk_buf[num_dsk_buf].radius = radius; + ++num_dsk_buf; + + return; +} + + void vroniObject::FreeDrawingBuffer(void) @@ -247,9 +261,11 @@ void vroniObject::FreeDrawingBuffer(void) vde_buf.clear(); off_buf.clear(); cir_buf.clear(); + dsk_buf.clear(); FreeMemory((void**) &vdn_buf, "redraw:vdn_buf"); FreeMemory((void**) &cur_buf, "redraw:cur_buf"); + num_dsk_buf = 0; num_cir_buf = 0; num_cur_buf = 0; num_vde_buf = 0; @@ -259,6 +275,7 @@ void vroniObject::FreeDrawingBuffer(void) num_seg_buf = 0; num_arc_buf = 0; max_num_cir_buf = 0; + max_num_dsk_buf = 0; max_num_cur_buf = 0; max_num_vde_buf = 0; max_num_off_buf = 0; @@ -351,8 +368,8 @@ void vroniObject::WriteIpeOutput(char *filename) for (i = 0; i < num_vde_buf; ++i) { if (vde_buf[i].color == VDColor) WriteLineSegment(fp, - vde_buf[i].p1.x, vde_buf[i].p1.y, - vde_buf[i].p2.x, vde_buf[i].p2.y); + vde_buf[i].p1.x, vde_buf[i].p1.y, + vde_buf[i].p2.x, vde_buf[i].p2.y); } WriteEndGroup(fp); } @@ -362,8 +379,8 @@ void vroniObject::WriteIpeOutput(char *filename) for (i = 0; i < num_vde_buf; ++i) { if (vde_buf[i].color == DTColor) WriteLineSegment(fp, - vde_buf[i].p1.x, vde_buf[i].p1.y, - vde_buf[i].p2.x, vde_buf[i].p2.y); + vde_buf[i].p1.x, vde_buf[i].p1.y, + vde_buf[i].p2.x, vde_buf[i].p2.y); } WriteEndGroup(fp); } @@ -373,18 +390,30 @@ void vroniObject::WriteIpeOutput(char *filename) for (i = 0; i < num_off_buf; ++i) { if (off_buf[i].r == 0) { WriteLineSegment(fp, - off_buf[i].p1.x, off_buf[i].p1.y, - off_buf[i].p2.x, off_buf[i].p2.y); + off_buf[i].p1.x, off_buf[i].p1.y, + off_buf[i].p2.x, off_buf[i].p2.y); } else { WriteCircularArc(fp, - off_buf[i].p3.x, off_buf[i].p3.y, - off_buf[i].p1.x, off_buf[i].p1.y, - off_buf[i].p2.x, off_buf[i].p2.y, - !off_buf[i].ccw); + off_buf[i].p3.x, off_buf[i].p3.y, + off_buf[i].p1.x, off_buf[i].p1.y, + off_buf[i].p2.x, off_buf[i].p2.y, + !off_buf[i].ccw); } } WriteEndGroup(fp); + if (draw_tool) { + if (num_dsk_buf > 0) { + WriteBeginGroup(fp, 8); + for (i = 1; i < num_dsk_buf; ++i) { + WriteCircle(fp, + dsk_buf[i].cntr.x, + dsk_buf[i].cntr.y, + dsk_buf[i].radius); + } + WriteEndGroup(fp); + } + } } if (draw_mat) { @@ -392,8 +421,8 @@ void vroniObject::WriteIpeOutput(char *filename) for (i = 0; i < num_vde_buf; ++i) { if (vde_buf[i].color == WMATColor) WriteLineSegment(fp, - vde_buf[i].p1.x, vde_buf[i].p1.y, - vde_buf[i].p2.x, vde_buf[i].p2.y); + vde_buf[i].p1.x, vde_buf[i].p1.y, + vde_buf[i].p2.x, vde_buf[i].p2.y); } WriteEndGroup(fp); } @@ -401,20 +430,26 @@ void vroniObject::WriteIpeOutput(char *filename) if (draw_mic) { if (num_cir_buf == 1) { WriteBeginGroup(fp, 5); + WriteCircle(fp, + cir_buf[0].cntr.x, + cir_buf[0].cntr.y, + cir_buf[0].radius); + /* WriteCircularArc(fp, - cir_buf[0].cntr.x, - cir_buf[0].cntr.y, - cir_buf[0].cntr.x, - cir_buf[0].cntr.y - cir_buf[0].radius, - cir_buf[0].cntr.x, - cir_buf[0].cntr.y + cir_buf[0].radius, true); + cir_buf[0].cntr.x, + cir_buf[0].cntr.y, + cir_buf[0].cntr.x, + cir_buf[0].cntr.y - cir_buf[0].radius, + cir_buf[0].cntr.x, + cir_buf[0].cntr.y + cir_buf[0].radius, true); WriteCircularArc(fp, - cir_buf[0].cntr.x, - cir_buf[0].cntr.y, - cir_buf[0].cntr.x, - cir_buf[0].cntr.y + cir_buf[0].radius, - cir_buf[0].cntr.x, - cir_buf[0].cntr.y - cir_buf[0].radius, true); + cir_buf[0].cntr.x, + cir_buf[0].cntr.y, + cir_buf[0].cntr.x, + cir_buf[0].cntr.y + cir_buf[0].radius, + cir_buf[0].cntr.x, + cir_buf[0].cntr.y - cir_buf[0].radius, true); + */ WriteEndGroup(fp); } } @@ -423,7 +458,7 @@ void vroniObject::WriteIpeOutput(char *filename) WriteBeginGroup(fp, 7); for (i = 0; i < num_vdn_buf; ++i) { WriteMark(fp, 2, 6, - nodes[vdn_buf[i].index].p.x, nodes[vdn_buf[i].index].p.y); + nodes[vdn_buf[i].index].p.x, nodes[vdn_buf[i].index].p.y); } WriteEndGroup(fp); } @@ -434,7 +469,7 @@ void vroniObject::WriteIpeOutput(char *filename) assert(InPntsList(pnt_buf[i].index)); if (!incremental || pnts[pnt_buf[i].index].draw) WriteMark(fp, 2, 6, - pnts[pnt_buf[i].index].p.x, pnts[pnt_buf[i].index].p.y); + pnts[pnt_buf[i].index].p.x, pnts[pnt_buf[i].index].p.y); } WriteEndGroup(fp); } @@ -515,7 +550,7 @@ void vroniObject::Redraw(void) for (i = 0; i < num_vde_buf; ++i) { if (vde_buf[i].color == VDColor) { DrawSeg(vde_buf[i].p1, vde_buf[i].p2, vde_buf[i].color); - } + } } if (draw_mic) { for (i = 0; i < num_vde_buf; ++i) { @@ -541,17 +576,22 @@ void vroniObject::Redraw(void) if (draw_off) { for (i = 0; i < num_off_buf; ++i) { - if (off_buf[i].r == 0) { + if (off_buf[i].r == 0.0) { DrawSeg(off_buf[i].p1, off_buf[i].p2, off_buf[i].color); } else { if (off_buf[i].ccw) DrawArc(off_buf[i].p2, off_buf[i].p1, off_buf[i].p3, - off_buf[i].r, off_buf[i].color); + off_buf[i].r, off_buf[i].color); else - DrawArc(off_buf[i].p1, off_buf[i].p2, off_buf[i].p3, - off_buf[i].r, off_buf[i].color); - } + DrawArc(off_buf[i].p1, off_buf[i].p2, off_buf[i].p3, + off_buf[i].r, off_buf[i].color); + } + } + if (draw_tool) { + for (i = 0; i < num_dsk_buf; ++i) { + DrawCircle(dsk_buf[i].cntr, dsk_buf[i].radius, TOOLColor); + } } } @@ -567,7 +607,7 @@ void vroniObject::Redraw(void) if (draw_segs && draw_arcs) { for (i = 0; i < num_seg_buf; ++i) { if ((!incremental || segs[seg_buf[i].index].draw) && - seg_buf[i].color == SegColor) + seg_buf[i].color == SegColor) BuffToDrawSeg(seg_buf[i].index, seg_buf[i].color); } } @@ -592,16 +632,16 @@ void vroniObject::Redraw(void) assert(InEdgesList(cur_buf[i].index)); if (draw_vde && (cur_buf[i].color == VDColor)) DrawSeg(nodes[edges[cur_buf[i].index].n1].p, - nodes[edges[cur_buf[i].index].n2].p, cur_buf[i].color); + nodes[edges[cur_buf[i].index].n2].p, cur_buf[i].color); else if (draw_mat && (cur_buf[i].color == WMATColor)) DrawSeg(nodes[edges[cur_buf[i].index].n1].p, - nodes[edges[cur_buf[i].index].n2].p, cur_buf[i].color); + nodes[edges[cur_buf[i].index].n2].p, cur_buf[i].color); break; case(DTE): assert(InPntsList(edges[cur_buf[i].index].n1)); assert(InPntsList(edges[cur_buf[i].index].n2)); DrawSeg(pnts[edges[cur_buf[i].index].n1].p, - pnts[edges[cur_buf[i].index].n2].p, cur_buf[i].color); + pnts[edges[cur_buf[i].index].n2].p, cur_buf[i].color); break; default: break; @@ -611,8 +651,8 @@ void vroniObject::Redraw(void) if (draw_vde && draw_vdn) { for (i = 0; i < num_vdn_buf; ++i) { DrawPnt(nodes[vdn_buf[i].index].p, vdn_buf[i].color, true); - DrawText(nodes[vdn_buf[i].index].p, vdn_buf[i].color, " n%d", - vdn_buf[i].index); + DrawText(nodes[vdn_buf[i].index].p, vdn_buf[i].color, " n%d", + vdn_buf[i].index); } } @@ -620,11 +660,11 @@ void vroniObject::Redraw(void) for (i = 0; i < num_pnt_buf; ++i) { assert(InPntsList(pnt_buf[i].index)); if (!incremental || - (pnts[pnt_buf[i].index].draw && !pnts[pnt_buf[i].index].del)) { + (pnts[pnt_buf[i].index].draw && !pnts[pnt_buf[i].index].del)) { DrawPnt(pnts[pnt_buf[i].index].p, pnt_buf[i].color, false); - DrawText(pnts[pnt_buf[i].index].p, pnt_buf[i].color, " p%d", - pnt_buf[i].index); - } + DrawText(pnts[pnt_buf[i].index].p, pnt_buf[i].color, " p%d", + pnt_buf[i].index); + } } } @@ -632,11 +672,11 @@ void vroniObject::Redraw(void) for (i = 0; i < num_pnt_buf; ++i) { assert(InPntsList(pnt_buf[i].index)); if (!HasIncidentSite(pnt_buf[i].index) && - !IsDeletedPnt(pnt_buf[i].index)) { + !IsDeletedPnt(pnt_buf[i].index)) { DrawPnt(pnts[pnt_buf[i].index].p, pnt_buf[i].color, false); } - DrawText(pnts[pnt_buf[i].index].p, pnt_buf[i].color, " p%d", - pnt_buf[i].index); + DrawText(pnts[pnt_buf[i].index].p, pnt_buf[i].color, " p%d", + pnt_buf[i].index); } } @@ -649,14 +689,14 @@ void vroniObject::Redraw(void) case(VDN): assert(InNodesList(cur_buf[i].index)); if ((draw_vde && (cur_buf[i].color != MICColor)) || - (draw_mic && (cur_buf[i].color == MICColor))) + (draw_mic && (cur_buf[i].color == MICColor))) DrawPnt(nodes[cur_buf[i].index].p, cur_buf[i].color, true); break; default: break; } } - + if (draw_mic) { for (i = 0; i < num_cir_buf; ++i) { DrawCircle(cir_buf[i].cntr, cir_buf[i].radius, MICColor); @@ -664,10 +704,10 @@ void vroniObject::Redraw(void) } for(i=0; i%d)", i, edges[i].n1, edges[i].n2); + DrawText(pos, VDColor, " e%d (%d>%d)", i, edges[i].n1, edges[i].n2); } if (!(draw_pnts || draw_segs || draw_arcs || draw_vde)) diff --git a/seg_seg_pnt.cc b/seg_seg_pnt.cc index 34ebadd..bc46385 100644 --- a/seg_seg_pnt.cc +++ b/seg_seg_pnt.cc @@ -67,7 +67,7 @@ vr_bool vroniObject::SegSegPntCntr(int i, int j, int k, int e, coord *cntr, { coord p, q, u, v, w, Q, centers[VRONI_MAXSOL]; int n1; - double ai, bi, ci, aj, bj, cj; + double ai, bi, ci, aj = 0.0, bj = 0.0, cj = 0.0; double alpha, beta, dist, x, y, z; double roots[2], eps; #ifdef TRACE diff --git a/seg_seg_seg.cc b/seg_seg_seg.cc index f20f20e..b9c7050 100644 --- a/seg_seg_seg.cc +++ b/seg_seg_seg.cc @@ -71,7 +71,8 @@ vr_bool vroniObject::SegSegSegCntr(int i, int j, int k, int e, coord *cntr, double *r2, vr_bool *problematic, int *site) { int m, n, n1, n2; - double dist, ai, bi, ci, aj, bj, cj, ak, bk, ck, c, t; + double dist, ai, bi, ci, aj = 0.0, bj = 0.0, cj = 0.0; + double ak = 0.0, bk = 0.0, ck = 0.0, c, t; coord Q, V, U, W, X, old_end, old_start; double A[2][2], B[2], xy[2], alpha, beta, gamma, delta; double radius1, radius2, eps; diff --git a/vd_arc.cc b/vd_arc.cc index 7e61607..0f9dc11 100644 --- a/vd_arc.cc +++ b/vd_arc.cc @@ -368,7 +368,7 @@ vr_bool vroniObject::IsSameSide(int i, t_site t, int j, int i1, coord p_node) if (trace_mvna) { printf("node %d accepted\n", k_min); printf("old distance: %20.16f, new distance: %20.16f\n", - dist_min, Min(dist, dist1)); + dist_min, VroniMin(dist, dist1)); PrintNodeData(k_min, "FindMostViolatedArc"); } #endif diff --git a/vd_basic.cc b/vd_basic.cc index dfd99ea..37bf366 100644 --- a/vd_basic.cc +++ b/vd_basic.cc @@ -56,7 +56,7 @@ void vroniObject::InitRelaxationMemory(double_arg t) void vroniObject::UpdateRelaxationMemory(double_arg t) { - curr_relaxation = Max(curr_relaxation, t); + curr_relaxation = VroniMax(curr_relaxation, t); return; } @@ -64,7 +64,7 @@ void vroniObject::UpdateRelaxationMemory(double_arg t) void vroniObject::ConfirmRelaxationMemory() { - max_relaxation = Max(max_relaxation, curr_relaxation); + max_relaxation = VroniMax(max_relaxation, curr_relaxation); return; } @@ -1527,6 +1527,7 @@ int vroniObject::ClassifySolutions(int i, int j, int k, int e, t_site t1, t2, t3; double d1, d2, d3, d4, rad1, rad2; double cs1, cs2, cs3; + double r; assert((*num_sol+2) < VRONI_MAXSOL); @@ -1644,8 +1645,8 @@ int vroniObject::ClassifySolutions(int i, int j, int k, int e, /* */ m1 = *num_sol - 3; for (m = 0; m < *num_sol; ++m) { - const coord c = centers[m]; - const double r = radii[m]; + c = centers[m]; + r = radii[m]; if ((r < too_large) || (best_qual > r)) { /* */ @@ -1741,7 +1742,7 @@ int vroniObject::ClassifySolutions(int i, int j, int k, int e, if (gt(best_qual, GRAZE)) *problematic = true; #ifdef VRONI_INFO - UpdateRelaxationMemory(Max(eps, best_qual)); + UpdateRelaxationMemory(VroniMax(eps, best_qual)); #endif return best_sol; diff --git a/vd_data.cc b/vd_data.cc index 4891ef2..c7aa877 100644 --- a/vd_data.cc +++ b/vd_data.cc @@ -25,6 +25,115 @@ #include "vroni_object.h" +void vroniObject::InsertBisectorClose(int i, t_site t, int e, int k, + int e1r, int e2l, int n1r, int n2l) +{ + int i0, e0; + t_site t0; + + /* */ + /* insert a new bisector and close a Voronoi cell. */ + /* */ + if (GetEndNode(e1r) == n1r) { + GetRgtSiteData(e1r, &i0, &t0); + } else { + assert(GetStartNode(e1r) == n1r); + GetLftSiteData(e1r, &i0, &t0); + } + e0 = StoreEdge(n1r, n2l, i, i0, t, t0); +#ifdef TRACE + if (dbg_center) { + printf("new edge %2d between sites (%2d/0, %2d/%1d) ", + e0, i, i0, t0); + printf("computed\n"); + printf("edge %d - start node %d, end node %d\n", e0, n1r, n2l); + } +#endif + CloseVoronoiCell(e1r, e0, e2l, n1r, n2l); + + /* */ + /* make sure the VD edge pointer is up-to-date */ + /* */ + SetVDPtr(i0, t0, e0); + + return; +} + + +void vroniObject::InsertReplacement(int i, t_site t, int n, int e, int k, + int* el, int* er, int* nl, int* nr) +{ + t_site t1, t2; + int i1, i2; + int n0, site = NIL; + coord q; + double r; + vr_bool problematic; + coord centers[4]; + double radii[4]; + int num_sol = 0, best_sol = NIL; + + /* */ + /* the Voronoi node nodes[k] is to be kept. insert a replacement */ + /* node for nodes[n] (which will be deleted). */ + /* */ + if (!IsNodeDummy(k)) MarkNodeUnchecked(k); + +#ifdef TRACE + if (dbg_center) { + printf("new center for edge %3d and site %3d of type %d\n", e, i, t); + GetLftSiteData(e, &i1, &t1); + GetRgtSiteData(e, &i2, &t2); + printf(" defining sites of edge: %2d/%1d, %2d/%1d)\n", + i1, t1, i2, t2); + } +#endif + if (!ComputeCenter(e, i, t, &q, &r, &problematic, &site)) { + if (restart) return; + if (IsInvalidData(false)) + return; + else { + VD_Dbg_Warning("UpdateRecursive() - desperate mode (center)!"); + centers[0] = q; + radii[0] = r; + DesperateComputeCenter(e, i, t, &q, &r); + centers[1] = q; + radii[1] = r; + num_sol = 2; + GetLftSiteData(e, &i1, &t1); + GetRgtSiteData(e, &i2, &t2); + best_sol = ClassifySolutions(i, i2, i1, e, t, t2, t1, + false, true, true, centers, radii, + &num_sol, ZERO_MAX, &problematic); + q = centers[best_sol]; + r = radii[best_sol]; + } + } + + /* */ + /* store the new node, and locally prepare the VD for the update. */ + /* */ + n0 = StoreNode(q.x, q.y, r); + if (site != NIL) SetNodeSite(n0, site); + +#ifdef TRACE + if (dbg_center) { + GetLftSiteData(e, &i1, &t1); + GetRgtSiteData(e, &i2, &t2); + printf("new node %2d between sites (%2d/%1d, %2d/%1d, %2d/%1d) ", + n0, i, t, i1, t1, i2, t2); + printf("computed\n"); + printf(" (%f, %f), radius2 = %f\n", q.x, q.y, r); + } +#endif + + UpdateNodeEdgeData(e, n, n0); + *el = *er = e; + *nl = *nr = n0; + + return; +} + void vroniObject::FreeVDConstructionData(void) { @@ -596,20 +705,12 @@ vr_bool vroniObject::ComputeCenter(int e, int i3, t_site t3, void vroniObject::UpdateRecursive(int i, t_site t, int n, int e, int *el, int *er, int *nl, int *nr) { - t_site t1, t2; - int i1, i2; #ifdef TRACE vr_bool dbg_center = false; #endif - int i0, n0, e0, k, e1, e2, site = NIL; + int k, e1, e2; int e1r, n1r, e2l, n2l; - t_site t0; coord q; - double r; - vr_bool problematic; - coord centers[4]; - double radii[4]; - int num_sol = 0, best_sol = NIL; assert((t == SEG) || (t == ARC)); @@ -622,7 +723,7 @@ void vroniObject::UpdateRecursive(int i, t_site t, int n, int e, if (dbg_center) { printf("UpdateRecursive - edge e=%d, node n=%d\n", e, n); printf("UpdateRecursive - checking node k=%d of degree %d", - k, 3 - IsDeg2Node(k)); + k, 3 - IsDeg2Node(k)); if (IsNodeDeleted(k)) printf(" --- to be deleted\n"); else printf(" --- to be kept\n"); } @@ -644,32 +745,11 @@ void vroniObject::UpdateRecursive(int i, t_site t, int n, int e, if (restart) return; UpdateRecursive(i, t, k, e2, &e2l, er, &n2l, nr); if (restart) return; - + /* */ /* insert a new bisector and close a Voronoi cell. */ /* */ - if (GetEndNode(e1r) == n1r) { - GetRgtSiteData(e1r, &i0, &t0); - } - else { - assert(GetStartNode(e1r) == n1r); - GetLftSiteData(e1r, &i0, &t0); - } - e0 = StoreEdge(n1r, n2l, i, i0, t, t0); -#ifdef TRACE - if (dbg_center) { - printf("new edge %2d between sites (%2d/0, %2d/%1d) ", - e0, i, i0, t0); - printf("computed\n"); - printf("edge %d - start node %d, end node %d\n", e0, n1r, n2l); - } -#endif - CloseVoronoiCell(e1r, e0, e2l, n1r, n2l); - - /* */ - /* make sure the VD edge pointer is up-to-date */ - /* */ - SetVDPtr(i0, t0, e0); + InsertBisectorClose(i, t, e, k, e1r, e2l, n1r, n2l); } /* */ /* delete edges[e] and nodes[k]. */ @@ -688,59 +768,7 @@ void vroniObject::UpdateRecursive(int i, t_site t, int n, int e, /* the Voronoi node nodes[k] is to be kept. insert a replacement */ /* node for nodes[n] (which will be deleted). */ /* */ - if (!IsNodeDummy(k)) MarkNodeUnchecked(k); - -#ifdef TRACE - if (dbg_center) { - printf("new center for edge %3d and site %3d of type %d\n", e, i, t); - GetLftSiteData(e, &i1, &t1); - GetRgtSiteData(e, &i2, &t2); - printf(" defining sites of edge: %2d/%1d, %2d/%1d)\n", - i1, t1, i2, t2); - } -#endif - if (!ComputeCenter(e, i, t, &q, &r, &problematic, &site)) { - if (restart) return; - if (IsInvalidData(false)) - return; - else { - VD_Dbg_Warning("UpdateRecursive() - desperate mode (center)!"); - centers[0] = q; - radii[0] = r; - DesperateComputeCenter(e, i, t, &q, &r); - centers[1] = q; - radii[1] = r; - num_sol = 2; - GetLftSiteData(e, &i1, &t1); - GetRgtSiteData(e, &i2, &t2); - best_sol = ClassifySolutions(i, i2, i1, e, t, t2, t1, - false, true, true, centers, radii, - &num_sol, ZERO_MAX, &problematic); - q = centers[best_sol]; - r = radii[best_sol]; - } - } - - /* */ - /* store the new node, and locally prepare the VD for the update. */ - /* */ - n0 = StoreNode(q.x, q.y, r); - if (site != NIL) SetNodeSite(n0, site); - -#ifdef TRACE - if (dbg_center) { - GetLftSiteData(e, &i1, &t1); - GetRgtSiteData(e, &i2, &t2); - printf("new node %2d between sites (%2d/%1d, %2d/%1d, %2d/%1d) ", - n0, i, t, i1, t1, i2, t2); - printf("computed\n"); - printf(" (%f, %f), radius2 = %f\n", q.x, q.y, r); - } -#endif - - UpdateNodeEdgeData(e, n, n0); - *el = *er = e; - *nl = *nr = n0; + InsertReplacement(i, t, n, e, k, el, er, nl, nr); } return; diff --git a/vroni_object.cc b/vroni_object.cc index ddee421..0af796c 100644 --- a/vroni_object.cc +++ b/vroni_object.cc @@ -198,6 +198,7 @@ vroniObject::vroniObject() draw_dte = false; draw_mat = false; draw_mic = false; + draw_tool = true; #endif pntd = (in_pnts*)NULL; @@ -449,6 +450,11 @@ vroniObject::vroniObject() num_tree = 0; max_num_tree = 0; + /* from hsm/path.cc */ + path_VD_ID = 0; + num_path_data = 0; + max_num_path_data = 0; + /* from memory.cc */ #ifdef DEBUG_MEMORY curr_memory = 0; @@ -785,7 +791,8 @@ void vroniObject::apiComputeVD(vr_bool save_data, vr_bool new_input, vr_bool tim restart_due_to_intersection = false; pnts_deleted = false; desperate = false; - + + cpu_time_path = 0.0; cpu_time_pre = 0.0; cpu_time_pnt = 0.0; cpu_time_seg = 0.0; @@ -907,6 +914,16 @@ void vroniObject::apiTerminateProgram() FP_printf("\nCPU-time Offsetting (MS): %9.1f (< 10 MS)", FP_PRNTARG(cpu_time_off)); } +#ifdef HSM + if (cpu_time_path > 0.0) { + FP_printf("\nCPU-time HSM path (MS): %9.1f", + FP_PRNTARG(cpu_time_path)); + } + else { + FP_printf("\nCPU-time HSM path (MS): %9.1f (< 10 MS)", + FP_PRNTARG(cpu_time_path)); + } +#endif if (cpu_time_wmat > 0.0) { FP_printf("\nCPU-time WMAT Computation (MS): %9.1f", FP_PRNTARG(cpu_time_wmat)); @@ -926,7 +943,7 @@ void vroniObject::apiTerminateProgram() } double cpu_time_tot = cpu_time_pre + cpu_time_pnt + cpu_time_seg + cpu_time_arc + cpu_time_off + cpu_time_wmat + cpu_time_mic - + cpu_time_cln; + + cpu_time_cln + cpu_time_path; if (!quiet) { if (cpu_time_tot > 0.0) { FP_printf("\n\nTotal CPU-time Consumption (MS): %9.1f\n", diff --git a/wmat.cc b/wmat.cc index 2852f08..57083fc 100644 --- a/wmat.cc +++ b/wmat.cc @@ -358,8 +358,8 @@ void vroniObject::ComputeWMATParabola(int i, int i1, int i2) else t_max = d / delta; - t_min = Max(t1, t_min); - t_max = Min(t2, t_max); + t_min = VroniMax(t1, t_min); + t_max = VroniMin(t2, t_max); if (t_max <= t_min) { /* angle too small */ SetWmatEdge(i, false); return; @@ -606,7 +606,7 @@ void vroniObject::ComputeWMATLine(int i) return; } else { - t_min = Max(t1, t_min); + t_min = VroniMax(t1, t_min); SetWmatRMin(i, t_min); } SetWmatRMax(i, t2);