Results 1 to 4 of 4

Thread: Qt3D: QPolygonMeshWithHole geometry

  1. #1
    Join Date
    Nov 2006
    Location
    Dresden, Germany
    Posts
    91
    Thanks
    9
    Thanked 7 Times in 7 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Lightbulb 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:

    Qt Code:
    1. // polygons defined 2D plane, n > 2
    2. // with vectors of first and last segment must not be parallel
    3. // inner polygon must not intersect with outer polygon, but may have a joined
    4. // point, but no joined segments
    5. QPolygonF outerPolygon = ...;
    6. QPolygonF innerPolygon = ...;
    7.  
    8. QPolygonMesh * mesh = new QPolygonMesh();
    9. mesh->setPolygon(outerPolygon);
    10. mesh->setInnerPolygon(innerPolygon);
    11. mesh->setMaxSegmentLength(0.1);
    To copy to clipboard, switch view to plain text mode 

    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
    Last edited by ghorwin; 11th December 2019 at 15:50.
    Andreas

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    4,317
    Thanks
    244
    Thanked 678 Times in 668 Posts
    Qt products
    Qt5
    Platforms
    Windows Android

    Default 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...
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

  3. #3
    Join Date
    Nov 2006
    Location
    Dresden, Germany
    Posts
    91
    Thanks
    9
    Thanked 7 Times in 7 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default 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
    Andreas

  4. #4
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    4,317
    Thanks
    244
    Thanked 678 Times in 668 Posts
    Qt products
    Qt5
    Platforms
    Windows Android

    Default Re: Qt3D: QPolygonMeshWithHole geometry

    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?
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

Similar Threads

  1. QScrollbar has no geometry
    By Ini in forum Qt Programming
    Replies: 4
    Last Post: 30th January 2016, 04:36
  2. Geometry of QWebElement
    By TeeT in forum Newbie
    Replies: 4
    Last Post: 17th April 2015, 16:48
  3. QPlainTextEdit and geometry
    By tuli in forum Qt Programming
    Replies: 2
    Last Post: 12th August 2014, 14:42
  4. frameGeometry vs Geometry
    By bossy in forum Newbie
    Replies: 4
    Last Post: 18th October 2013, 01:55
  5. QGraphicsLayout::geometry()
    By isutruk in forum Qt Programming
    Replies: 1
    Last Post: 19th October 2009, 16:43

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.