Ejemplo n.º 1
0
int fps_cam_c::set_foot_height (double h) {
  pos.y = h;

  update_target ();

  return 1;
}
Ejemplo n.º 2
0
int git_transaction_commit(git_transaction *tx)
{
	transaction_node *node;
	git_strmap_iter pos;
	int error = 0;

	assert(tx);

	for (pos = kh_begin(tx->locks); pos < kh_end(tx->locks); pos++) {
		if (!git_strmap_has_data(tx->locks, pos))
			continue;

		node = git_strmap_value_at(tx->locks, pos);
		if (node->reflog) {
			if ((error = tx->db->backend->reflog_write(tx->db->backend, node->reflog)) < 0)
				return error;
		}

		if (node->ref_type != GIT_REF_INVALID) {
			if ((error = update_target(tx->db, node)) < 0)
				return error;
		}
	}

	return 0;
}
Ejemplo n.º 3
0
int git_transaction_commit(git_transaction *tx)
{
	transaction_node *node;
	int error = 0;

	assert(tx);

	if (tx->type == TRANSACTION_CONFIG) {
		error = git_config_unlock(tx->cfg, true);
		tx->cfg = NULL;

		return error;
	}

	git_strmap_foreach_value(tx->locks, node, {
		if (node->reflog) {
			if ((error = tx->db->backend->reflog_write(tx->db->backend, node->reflog)) < 0)
				return error;
		}

		if (node->ref_type != GIT_REF_INVALID) {
			if ((error = update_target(tx->db, node)) < 0)
				return error;
		}
	});
Ejemplo n.º 4
0
// change height relative to its current value
int fps_cam_c::change_height_rel (double delta) {
  height += delta;

  update_target ();

  return 0;
}
Ejemplo n.º 5
0
static void 
flip_page(void) 
{
	//FIXME - update_target() should be called by event handler when window
	//        is resized or moved
	update_target();
	LOG("video_out_3dfx: calling blt function\n");
	screen_to_screen_stretch_blt(targetoffset, vidpage2offset, dispwidth, dispheight);
}
Ejemplo n.º 6
0
void si2cs_received(uint8_t *buf, uint8_t len) {
	if (len != 3) return;

	if (buf[0] == 0xba) {
		if (buf[1] == conf_address) {
			uint16_t new_target = (buf[2] * conf_steps_per_num + conf_offset);
			if (new_target > conf_steps_total) {
				new_target -= conf_steps_total;
			}
			update_target(new_target);
		}
	}
}
Ejemplo n.º 7
0
// pan camera around view globe
int fps_cam_c::pan (v2d_t a) {
  // update these values
  facing += a.x;
  elevation += a.y;

  // now make sure the new values are in range
  constrain ();

  // since things changed
  update_target ();

  return 0;
}
Ejemplo n.º 8
0
fps_cam_c::fps_cam_c () {
  // set the 'feet' the be the origin
  pos = v3d_v (0.0, 0.0, 0.0);
  height = 1.9;

  facing = 0.0;

  elevation = DEG2RAD (0.0);
  elevation_min = DEG2RAD (-80.0);
  elevation_max = DEG2RAD (80.0);

  // figure out where we're looking
  update_target ();

  // set up to be straight up
  up = v3d_v (0, 1, 0);
}
Ejemplo n.º 9
0
int GBDT::fit() {
    int samples = _m_train_data.size();
    if (_m_sample_ratio < 1) {
        samples = samples * _m_sample_ratio;
    }

    init_fit();

    for (int iter = 0; iter < _m_iterations; iter++) {
        LOG_EVERY_N(INFO, 10) << "iteration: " << iter;

        if (_m_sample_ratio < 1) {
            _m_train_data.random();
        }
        if (_m_thread_num > 1 && iter > 100) {
            for (int i = 0; i < _m_thread_num; i++) {
                _m_multi_data[i].max_tree_num = iter;
                pthread_create(&_m_multi_thread[i], NULL, multi_predict, (void*)(&_m_multi_data[i]));
            }
            for (int i = 0; i < _m_thread_num; i++) {
                pthread_join(_m_multi_thread[i], NULL);
            }
        } else {
            for (int s_idx = 0; s_idx < samples; s_idx++) {
                GBDTValue p;

                predict(_m_train_data[s_idx], iter, p);

                update_target(s_idx, p);
            }
        }
        _m_trees[iter].fit(&_m_train_data, samples);
        if ((iter + 1) % _m_save_tmp == 0) {
            LOG(INFO) << iter << " " << _m_save_tmp;
            save_tmp(iter + 1);
        }
    }
    _m_cur_iterations = _m_iterations;

    cal_gain();
    return 0;
}
Ejemplo n.º 10
0
// translate the camera and target position
int fps_cam_c::translate (v2d_t a) {
  // get a vector pointing the way the camera is facing
  v2d_t t1 = v2d_v (cos (facing), sin (facing));

  v2d_t t_fb; // translation forward or back
  v2d_t t_lr; // translate left and right

  // this is the forward-backward translation
  t_fb = v2d_scale (t1, a.y);

  // this is the side-side translation
  t_lr = v2d_scale (v2d_normal (t1), a.x);

  // update the position
  pos.x += t_fb.x + t_lr.x;
  pos.z += t_fb.y + t_lr.y;

  update_target ();

  return 0;
}
void TouchCalibrationView::set_phase(const Phase value) {
	if( value != phase ) {
		phase = value;
		update_target();
	}
}