Exemplo n.º 1
0
void RenderingWidget::mousePressEvent(QMouseEvent *e)
{
	switch (e->button())
	{
	case Qt::LeftButton:
		ptr_arcball_->MouseDown(e->pos());
		if (op_mode_ == CHOOSEBASE)
		{
			CaptureVertex(e->pos());
		}
		else
		if (op_mode_ == CHOOSECEILING)
		{
			CaptureEdge(e->pos());
		}
		else
		{
			if (!CaptureVertex(e->pos()))
			{
				CaptureEdge(e->pos());
			}
		}
		break;
	case Qt::MidButton:
		current_position_ = e->pos();
		break;
	case Qt::RightButton:
		if (op_mode_ == CHOOSEBASE)
		{
			if (captured_verts_.size() > 0)
			{
				WF_vert *u = captured_verts_[captured_verts_.size() - 1];
				captured_verts_.pop_back();
				is_captured_vert_[u->ID()] = false;
			}
		}
		else
		if (op_mode_ == CHOOSECEILING)
		{
			if (captured_edges_.size() > 0)
			{
				WF_edge *e = captured_edges_[captured_edges_.size() - 1];
				captured_edges_.pop_back();
				is_captured_edge_[e->ID()] = false;
				is_captured_edge_[e->ppair_->ID()] = false;
			}
		}
		else
		{
		}
		break;
	default:
		break;
	}

	updateGL();
}
Exemplo n.º 2
0
void SeqAnalyzer::UpdateStructure(WF_edge *e)
{
	upd_struct_.Start();

	int dual_upd = ptr_dualgraph_->UpdateDualization(e);

	/* modify D0 */
	if (dual_upd != -1)
	{
		int Ns = ptr_dualgraph_->SizeOfFreeFace();
		D0_.conservativeResize(6 * Ns);

		/* set initiate value by neighbors */
		int orig_u = ptr_dualgraph_->v_orig_id(dual_upd);
		WF_edge *eu = ptr_frame_->GetNeighborEdge(orig_u);

		VX sum_D(6);
		sum_D.setZero();
		int sum = 0;

		while (eu != NULL)
		{
			WF_vert *v = eu->pvert_;
			int dual_v = ptr_dualgraph_->v_dual_id(v->ID());
			if (dual_v != -1 && !v->isFixed())
			{
				VX tmp_D(6);
				for (int i = 0; i < 6; i++)
				{
					tmp_D[i] = D0_[6 * dual_v + i];
				}
				sum_D += tmp_D;
				sum++;
			}
			eu = eu->pnext_;
		}

		if (sum != 0)
		{
			sum_D /= sum;
		}
		for (int i = 0; i < 6; i++)
		{
			D0_[6 * (Ns - 1) + i] = sum_D[i];
		}
	}

	upd_struct_.Stop();
}