mirror of https://github.com/CGAL/cgal
Implemented the empty circumcircle button
This commit is contained in:
parent
ae5565d912
commit
5487601ae1
|
|
@ -33,7 +33,6 @@ protected:
|
||||||
private:
|
private:
|
||||||
|
|
||||||
DT * dt;
|
DT * dt;
|
||||||
typename DT::Vertex_handle hint;
|
|
||||||
typename DT::Face_handle fh;
|
typename DT::Face_handle fh;
|
||||||
QGraphicsScene *scene_;
|
QGraphicsScene *scene_;
|
||||||
QGraphicsEllipseItem* circle;
|
QGraphicsEllipseItem* circle;
|
||||||
|
|
@ -46,7 +45,6 @@ TriangulationCircumcircle<DT>::TriangulationCircumcircle(QGraphicsScene* s,
|
||||||
QObject* parent)
|
QObject* parent)
|
||||||
: GraphicsViewInput(parent), dt(dt_), scene_(s)
|
: GraphicsViewInput(parent), dt(dt_), scene_(s)
|
||||||
{
|
{
|
||||||
hint = typename DT::Vertex_handle();
|
|
||||||
circle = new QGraphicsEllipseItem();
|
circle = new QGraphicsEllipseItem();
|
||||||
circle->hide();
|
circle->hide();
|
||||||
scene_->addItem(circle);
|
scene_->addItem(circle);
|
||||||
|
|
@ -87,28 +85,26 @@ template <typename DT>
|
||||||
void
|
void
|
||||||
TriangulationCircumcircle<DT>::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
|
TriangulationCircumcircle<DT>::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
|
||||||
{
|
{
|
||||||
if(dt->dimension() != 2){
|
// std::cout << __PRETTY_FUNCTION__ << std::endl;
|
||||||
circle->hide();
|
if(dt->dimension() != 2){
|
||||||
return;
|
circle->hide();
|
||||||
}
|
return;
|
||||||
|
}
|
||||||
typename DT::Point p = typename DT::Point(event->scenePos().x(), event->scenePos().y());
|
typename DT::Point p = typename DT::Point(event->scenePos().x(), event->scenePos().y());
|
||||||
|
|
||||||
double dx = dt->domain().xmax() - dt->domain().xmin();
|
double dx = dt->domain().xmax() - dt->domain().xmin();
|
||||||
double dy = dt->domain().ymax() - dt->domain().ymin();
|
double dy = dt->domain().ymax() - dt->domain().ymin();
|
||||||
p = typename DT::Point(p.x()- std::floor(p.x()/dx), p.y()- std::floor(p.y()/dy));
|
p = typename DT::Point(p.x()- std::floor(p.x()/dx), p.y()- std::floor(p.y()/dy));
|
||||||
|
|
||||||
fh = dt->locate(p, hint->face());
|
fh = dt->locate(p);
|
||||||
hint = fh->vertex(0);
|
|
||||||
if(!dt->is_infinite(fh)){
|
typename DT::Triangle triangle = dt->triangle(dt->periodic_triangle(fh));
|
||||||
typename DT::Geom_traits::Circle_2 c(fh->vertex(0)->point(),
|
typename DT::Geom_traits::Circle_2 c(triangle[0],
|
||||||
fh->vertex(1)->point(),
|
triangle[1],
|
||||||
fh->vertex(2)->point());
|
triangle[2]);
|
||||||
CGAL::Bbox_2 bb = c.bbox();
|
CGAL::Bbox_2 bb = c.bbox();
|
||||||
circle->setRect(bb.xmin(), bb.ymin(), bb.xmax()-bb.xmin(), bb.ymax()-bb.ymin());
|
circle->setRect(bb.xmin(), bb.ymin(), bb.xmax()-bb.xmin(), bb.ymax()-bb.ymin());
|
||||||
circle->show();
|
circle->show();
|
||||||
} else {
|
|
||||||
circle->hide();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
#ifndef CGAL_QT_TRIANGULATION_REMOVE_VERTEX_H
|
#ifndef CGAL_QT_TRIANGULATION_REMOVE_VERTEX_H
|
||||||
#define CGAL_QT_TRIANGULATION_REMOVE_VERTEX_H
|
#define CGAL_QT_TRIANGULATION_REMOVE_VERTEX_H
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue