Qt3D: QPolygonMeshWithHole geometry

Hi there,

does anybody have a mesh implementation for a polygon mesh (ideally with hole) ready or does anybody know about a project using such a mesh?

If there's nothing like that available, I would create such a mesh myself - in such case I'd appreciate feedback/suggestions on the API. Currently I would favour something like:

Code:

// polygons defined 2D plane, n > 2

// with vectors of first and last segment must not be parallel

// inner polygon must not intersect with outer polygon, but may have a joined

// point, but no joined segments

QPolygonMesh * mesh = new QPolygonMesh();

mesh->setPolygon(outerPolygon);

mesh->setInnerPolygon(innerPolygon);

mesh->setMaxSegmentLength(0.1);

Polygon would be created in x-z plane such, that p0 is the origin (0,0,0) (translating all polygon points accordingly).

What do you think?

-Andreas

Re: Qt3D: QPolygonMeshWithHole geometry

Are these polygons actually circles or ellipses? You could use QPainterPath to create the ellipse, then use QPainterPath::toFillPolygon() to extract the QPolygonF from it.

Of course, QPolygonF is 2D only...

Re: Qt3D: QPolygonMeshWithHole geometry

Hi,

actually, the result needs to be a *mesh* encapsulated in a class that implements Qt3DRender::QGeometryRenderer interface and provides the required properties. These will be a set of vertices, and faces that represent a triangulated surface.

So, I'm looking for a class that implements the process of taking the outer (and optionally inner) polygon and performing a triangulation (see for example http://www.cs.cmu.edu/~quake/triangle.html) and generating the data structures to implement Qt3DRender::QGeometryRenderer just like Qt3DExtras::QConeMesh.

I'm afraid the QPainterPath::toFillPolygon() algorithm won't help here :-(

-Andreas

Re: Qt3D: QPolygonMeshWithHole geometry

Quote:

I'm afraid the QPainterPath::toFillPolygon() algorithm won't help here :-(

Well, you -did- ask for polygons in your original post. I have never looked into 3D triangulation, only 2D. As you note with your link to the Triangle page, there are many excellent implementations triangulating planar surfaces.

Can't you adapt Triangle's output for your purposes?