Skip to content

Commit

Permalink
Enabled extend ratio for specified shot.
Browse files Browse the repository at this point in the history
  • Loading branch information
smudrak committed Aug 12, 2020
1 parent 295ceb0 commit 0dda786
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 11 deletions.
22 changes: 15 additions & 7 deletions thdata.cxx
Expand Up @@ -2524,17 +2524,25 @@ void thdata::set_data_extend(int nargs, char ** args)
to_index = 2;
thdataextend dumm;
cextend = thmatch_token(args[0], thtt_extendflag);
bool ratio_ok;
ratio_ok = false;
if (cextend == TT_EXTENDFLAG_UNKNOWN) {
if (nargs == 1) {
thparse_double(exn, tmpdbl, args[0]);
if ((nargs == 1) || (nargs == 3)) {
thparse_double(exn, tmpdbl, args[0]);
if (exn == TT_SV_NUMBER) {
if ((tmpdbl < 0.0) || (tmpdbl > 100.0))
ththrow(("extend ration out of range [0..100] -- %s", args[0]))
this->d_extend_ratio = tmpdbl / 100.0;
return;
if ((tmpdbl < 0.0) || (tmpdbl > 200.0))
ththrow(("extend ratio out of range [0..200] -- %s", args[0]))
ratio_ok = true;
if (nargs == 1) {
this->d_extend_ratio = tmpdbl / 100.0;
return;
}
else
dumm.extend_ratio = tmpdbl / 100.0;
}
}
ththrow(("unknown extend flag -- %s", args[0]))
if (!ratio_ok)
ththrow(("unknown extend flag -- %s", args[0]))
}
switch (nargs) {
case 1:
Expand Down
4 changes: 3 additions & 1 deletion thdataleg.h
Expand Up @@ -566,7 +566,9 @@ class thdataextend {

int extend;

thdataextend() {}
double extend_ratio;

thdataextend() : extend_ratio(1.0) {}

};

Expand Down
12 changes: 9 additions & 3 deletions thdb1d.cxx
Expand Up @@ -3049,7 +3049,10 @@ void thdb1d::process_xelev()
carrow->leg->leg->extend |= TT_EXTENDFLAG_VERTICAL;
carrow->negative->extend |= TT_EXTENDFLAG_VERTICAL;
break;
default:
case TT_EXTENDFLAG_UNKNOWN:
carrow->leg->leg->extend_ratio = xi->extend_ratio;
break;
default:
carrow->leg->leg->extend |= xi->extend;
}
}
Expand Down Expand Up @@ -3372,11 +3375,14 @@ void thdb1d::process_xelev()
#endif
if (thcfg.log_extend) {
if ((prev_id != current_node->last_arrow->end_node->id) && !this->station_vec[current_node->last_arrow->end_node->id - 1].is_temporary()) {
thprintf("%s %s@%s\n",
thprintf("%s %s@%s",
(go_left == -1 ? "LEFT" : (go_left == 1 ? "RIGHT" : "VERTICAL")),
this->station_vec[current_node->last_arrow->end_node->id - 1].name,
this->station_vec[current_node->last_arrow->end_node->id - 1].survey->get_full_name());
prev_id = current_node->last_arrow->end_node->id;
if (current_node->last_arrow->leg->leg->extend_ratio != 1.0)
thprintf(" (%.0f%%)", current_node->last_arrow->leg->leg->extend_ratio * 100.0);
thprintf("\n");
}
}

Expand Down Expand Up @@ -3440,7 +3446,7 @@ void thdb1d::process_xelev()
current_node->first_arrow->leg->leg->fxx = minshot_x;
current_node->first_arrow->leg->leg->txx = minshot_x + minshot_dx * cos(diffdir(minshot_dir, splay_dir)) * hypot(current_node->first_arrow->leg->leg->total_dx, current_node->first_arrow->leg->leg->total_dy) * minshot_rx;
} else
ththrow(("Code should go here!"))
ththrow(("Code should not go here!"))
}
}

Expand Down

0 comments on commit 0dda786

Please sign in to comment.