Vroni 7.7 :
- aggiornamento versione.
This commit is contained in:
+1
-4
@@ -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);
|
||||
|
||||
@@ -625,8 +625,6 @@ int vroniObject::IntersectTwoCircles( const coord & c1, const coord & c2,
|
||||
|
||||
return 2;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
+80
-16
@@ -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 */
|
||||
@@ -169,10 +178,9 @@ 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,
|
||||
fprintf(stderr,
|
||||
" [--wmat] [--wmat_angle FFF] [--wmat_dist FFF]");
|
||||
fprintf(stderr,
|
||||
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,10 +686,9 @@ void vroniObject::EvalError(void)
|
||||
fprintf(stderr,
|
||||
"--mic: compute the maximum inscribed/empty circle.\n");
|
||||
#ifdef MAT
|
||||
#ifdef WMAT
|
||||
fprintf(stderr,
|
||||
"--wmat: compute (weighted) medial axis\n");
|
||||
#endif
|
||||
#ifdef WMAT
|
||||
fprintf(stderr,
|
||||
"--wmat_angle a: angle threshold for WMAT computation\n");
|
||||
fprintf(stderr,
|
||||
@@ -649,6 +697,10 @@ void vroniObject::EvalError(void)
|
||||
"--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 */
|
||||
|
||||
@@ -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
|
||||
#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;
|
||||
}
|
||||
}
|
||||
if (computed && finished && !quiet && off_finished) {
|
||||
#endif
|
||||
|
||||
if (computed && finished && !quiet && (off_finished || path_computed)) {
|
||||
/* */
|
||||
/* hey, let's ring the bell */
|
||||
/* */
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
/* */
|
||||
/* this file is reserved for application-specific routines that need to */
|
||||
/* access my HSM path data structures */
|
||||
/* */
|
||||
+2
-2
@@ -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))
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
@@ -385,6 +402,18 @@ void vroniObject::WriteIpeOutput(char *filename)
|
||||
}
|
||||
}
|
||||
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) {
|
||||
@@ -401,6 +430,11 @@ 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,
|
||||
@@ -415,6 +449,7 @@ void vroniObject::WriteIpeOutput(char *filename)
|
||||
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);
|
||||
}
|
||||
}
|
||||
@@ -541,7 +576,7 @@ 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 {
|
||||
@@ -553,6 +588,11 @@ void vroniObject::Redraw(void)
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (draw_arcs) {
|
||||
|
||||
+1
-1
@@ -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
|
||||
|
||||
+2
-1
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
+6
-5
@@ -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;
|
||||
|
||||
+112
-84
@@ -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));
|
||||
|
||||
@@ -648,28 +749,7 @@ void vroniObject::UpdateRecursive(int i, t_site t, int n, int e,
|
||||
/* */
|
||||
/* 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;
|
||||
|
||||
+18
-1
@@ -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;
|
||||
@@ -786,6 +792,7 @@ void vroniObject::apiComputeVD(vr_bool save_data, vr_bool new_input, vr_bool tim
|
||||
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",
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user