23 binary_search(
double val,
const double *array,
int bot,
int top) {
27 int mid = (bot + top)/2;
29 if (array[mid] < val) {
30 return binary_search(val, array, mid+1, top);
32 return binary_search(val, array, bot, mid-1);
45 _cuts.erase(_cuts.begin(), _cuts.end());
47 for (c = 1; c < _num_cuts+1; c++) {
48 double val = (double)c * ct / (
double)(_num_cuts+1) + _cint[_f];
49 int i = binary_search(val, _cint, _f, _t);
50 if (i != last && i < _t) {
56 while ((
int)_cuts.size() < _num_cuts) {
61 for (c = 0; c < (int)_cuts.size(); c++) {
62 if (mc == -1 || _cuts[c] - last > mv) {
74 _cuts.insert(_cuts.begin() + mc, (_cuts[mc] + _f) / 2);
76 _cuts.insert(_cuts.begin() + mc, (_cuts[mc] + _cuts[mc-1]) / 2);
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
double get_score() const
Returns the net score of the segment.
void cut()
Applies _num_cuts cuts to the segment.