Results 1 to 3 of 3

Thread: 3D line drawing (CAD program)

  1. #1
    Join Date
    Jul 2017
    Posts
    37
    Qt products
    Qt5
    Platforms
    Unix/X11

    Default 3D line drawing (CAD program)

    I'm writing a CAD program and am thinking of using Qt5 for the GUI. Most of the drawing objects are curves, of a kind peculiar to surveying, but I can approximate them arbitrarily closely with chains of cubic Bézier splines. The view will usually be directly from above with parallel rays, but there may be cases where I'll want to tilt the view. I'll need to do hit-testing, including finding the intersection of two lines, finding the foot of perpendicular to a line, etc. Is there a widget designed for this, or should I subclass QWidget and implement it myself?

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: 3D line drawing (CAD program)

    There is no QWidget that can do this kind of thing out of the box. I would advise you to look at the Qt Graphics / View framework and some of the many examples based on it. Classes derived from QGraphicsItem have support for hit detection and so forth, and the QGraphicsScene supports use of floating point world coordinates and transformations. What is doesn't do is support 3D coordinate systems, so you will have to write your own transformations from your objects' 3D coordinates to screen object 2D coordinates.

    Qt3D is pretty much useless for any kind of technical graphics. It's primarily designed for real-time scene rendering for animated graphics like games.

    Other than that, I don't know of anything that would give you a head start. You could start with QWidget, but you'd be basically starting at zero and would have to write literally everything.
    <=== 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
    Feb 2015
    Location
    Poland
    Posts
    34
    Thanked 1 Time in 1 Post
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows Android

    Default Re: 3D line drawing (CAD program)

    You definitely don't want use QWidget as it bases on "old fashioned" 2D Gui interface with out acceleration (WinApi on WinDos and XLib on Linux). Mentioned Graphics View Framework is accelerated when it is possible (read: implemented). I suppose is this true for WinDos, MacOS and most Linux distros (but this should be verified before you start programing).

Similar Threads

  1. Drawing a line on a QImage
    By Pritcher in forum Newbie
    Replies: 1
    Last Post: 1st April 2015, 17:01
  2. Difficulty in drawing a line
    By rezas1000 in forum Newbie
    Replies: 9
    Last Post: 31st August 2014, 15:03
  3. Drawing line on table
    By kocakden in forum Qt Programming
    Replies: 7
    Last Post: 29th April 2008, 10:50
  4. Line drawing in Designer
    By Doug Broadwell in forum Newbie
    Replies: 8
    Last Post: 28th March 2007, 01:02
  5. Line drawing
    By kiranraj in forum Qt Programming
    Replies: 1
    Last Post: 29th January 2007, 07:38

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.