Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] Extending TriangulationGraphicsItem<T> problem

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] Extending TriangulationGraphicsItem<T> problem


Chronological Thread 
  • From: Andreas Fabri <>
  • To:
  • Subject: Re: [cgal-discuss] Extending TriangulationGraphicsItem<T> problem
  • Date: Sat, 24 Jul 2010 18:28:56 +0200
  • Organization: GeometryFactory

I forgot this in my previous mail:

another source of inspiration might be the Constrained triangulation demo as it also draws the faces in a bounded domain.

andreas

On 23/07/2010 21:00, Yvan Maillot wrote:
Hi Again,

Sorry to post this again but I am looking for my mistake for a while, in vain.
Any idea ?

I am trying to extend TriangulationGraphicsItem<T> with a class I called
TriangulationGraphicsItemWithFaces<T> in order to also draw faces (triangles)
of a Delaunay triangulation.

To do this I have overridden the drawAll method like as follow. It almost
works: faces are drawn. But they are drawn at a wrong place. Faces are
translated compared with edges and vertices. Indeed, the origin of the faces
seems to be on the left top of the screen instead of being in the middle. I
also tried to use resetMatrix() and so on, and other stuff but nothing works.
I
don't know at all where I'm wrong.

What can I do to fix this problem?

Thanks for your help.

Yvan

// The overridden method
template<typename T>
void
TriangulationGraphicsItemWithFaces<T>::drawAll(QPainter *painter) {
// Calling drawAll method of the TriangulationGraphicsItem<T> super class
TriangulationGraphicsItem<T>::drawAll(painter);
if (visible_faces) {
if (TriangulationGraphicsItem<T>::t->number_of_vertices()> 2) {
QColor color(::Qt::blue);
color.setAlpha(150);
faces_brush.setColor(color);
faces_brush.setStyle(::Qt::SolidPattern);
painter->setBrush(faces_brush);
painter->setPen(::Qt::NoPen);

for (typename T::Finite_faces_iterator fit =

TriangulationGraphicsItem<T>::t->finite_faces_begin();
fit != TriangulationGraphicsItem<T>::t->finite_faces_end();
++fit) {

TriangulationGraphicsItem<T>::painterostream<<

TriangulationGraphicsItem<T>::t->triangle(fit);

}
}
}
}





Archive powered by MHonArc 2.6.16.

Top of Page