コード例 #1
0
ファイル: tmcomp.cpp プロジェクト: Fandekasp/steps
std::vector<double> stetmesh::TmComp::getBoundMax(void) const
{
    std::vector<double> b_max(3);
    b_max[0] = pXmax;
    b_max[1] = pYmax;
    b_max[2] = pZmax;
    return b_max;
}
コード例 #2
0
void BoundCreation::MergeAABBs(const AABB * aabb_a, const AABB * aabb_b, AABB * rtn_aabb)
{
	Eigen::Vector3f a_min(aabb_a->GetCenter() - aabb_a->GetExtents());
	Eigen::Vector3f a_max(aabb_a->GetCenter() + aabb_a->GetExtents());
	Eigen::Vector3f b_min(aabb_b->GetCenter() - aabb_b->GetExtents());
	Eigen::Vector3f b_max(aabb_b->GetCenter() + aabb_b->GetExtents());
	Eigen::Vector3f rtn_min;
	Eigen::Vector3f rtn_max;

	rtn_min[0] = std::min(a_min[0], b_min[0]);
	rtn_min[1] = std::min(a_min[1], b_min[1]);
	rtn_min[2] = std::min(a_min[2], b_min[2]);

	rtn_max[0] = std::max(a_max[0], b_max[0]);
	rtn_max[1] = std::max(a_max[1], b_max[1]);
	rtn_max[2] = std::max(a_max[2], b_max[2]);

	rtn_aabb->SetExtents((rtn_max - rtn_min) * 0.5f);
	rtn_aabb->SetCenter((rtn_max + rtn_min) * 0.5f);
}
コード例 #3
0
ファイル: 3DPlotView.cpp プロジェクト: jontheepi/geoda
C3DPlotCanvas::C3DPlotCanvas(Project* project_s, C3DPlotFrame* t_frame,
							 HighlightState* highlight_state_s,
							 const std::vector<GeoDaVarInfo>& v_info,
							 const std::vector<int>& col_ids,
							 wxWindow *parent,
							 wxWindowID id, const wxPoint& pos,
							 const wxSize& size, long style)
: wxGLCanvas(parent, id, pos, size, style), ball(0),
project(project_s), table_int(project_s->GetTableInt()),
num_obs(project_s->GetTableInt()->GetNumberRows()), num_vars(v_info.size()),
num_time_vals(1), highlight_state(highlight_state_s), var_info(v_info),
data(v_info.size()), scaled_d(v_info.size()),
c3d_plot_frame(t_frame)
{
	selectable_fill_color = GdaConst::three_d_plot_default_point_colour;
	highlight_color = GdaConst::three_d_plot_default_highlight_colour;
	canvas_background_color=GdaConst::three_d_plot_default_background_colour;
	
	data_stats.resize(var_info.size());
	var_min.resize(var_info.size());
	var_max.resize(var_info.size());
	
	std::vector<double> temp_vec(num_obs);
	for (int v=0; v<num_vars; v++) {
		table_int->GetColData(col_ids[v], data[v]);
		table_int->GetColData(col_ids[v], scaled_d[v]);
		int data_times = data[v].shape()[0];
		data_stats[v].resize(data_times);
		for (int t=0; t<data_times; t++) {
			for (int i=0; i<num_obs; i++) {
				temp_vec[i] = data[v][t][i];
			}
			data_stats[v][t].CalculateFromSample(temp_vec);
		}
	}
	
	c3d_plot_frame->ClearAllGroupDependencies();
	for (int i=0, sz=var_info.size(); i<sz; ++i) {
		c3d_plot_frame->AddGroupDependancy(var_info[i].name);
	}
	
	VarInfoAttributeChange();
	UpdateScaledData();
	
	xs = 0.1;
	xp = 0.0;
    ys = 0.1;
	yp = 0.0;
	zs = 0.1;
	zp = 0.0;
	
	m_bLButton = false;
	m_bRButton = false;
	m_brush = false;

	bb_min[0] = -1;
	bb_min[1] = -1;
	bb_min[2] = -1;
	bb_max[0] = 1;
	bb_max[1] = 1;
	bb_max[2] = 1;
	Vec3f b_min(bb_min);
	Vec3f b_max(bb_max);
	Vec3f ctr((bb_max[0]+bb_min[0])/2.0f, (bb_max[1]+bb_min[1])/2.0f,
			  (bb_max[2]+bb_min[2])/2.0f);
	
	float radius = norm(b_max - ctr);
	ball = new Arcball();
	ball->bounding_sphere(ctr, radius);

	m_x = false;
	m_y = false;
	m_z = false;
	m_d = true;
	b_select = false;
	isInit = false;
	
	highlight_state->registerObserver(this);
}