Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Line modeling

Line modeling

Scheduled Pinned Locked Moved General and Desktop
6 Posts 4 Posters 1.5k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    jcooper
    wrote on last edited by
    #1

    Hey, I want to write the line modeling application. You've got a line and you can model it in the way you want, add new points on the line, drag them, making brezier curves between them, making straight lines between them etc. I was trying with QPainterPath and functions like cubicTo etc, but there is not much information about current line (for example: y coordinate at given x coordinate on that line). I was also trying to use OpenCascade libraries, but it seems too complicated for such application and I cannot find easy examples which shows how to make 2D scene and draw on it.

    Could you give me some hints what tools may i use? Or maybe some examples with such applications?

    1 Reply Last reply
    0
    • Chris KawaC Offline
      Chris KawaC Offline
      Chris Kawa
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi, welcome to devnet

      bq. but there is not much information about current line (for example: y coordinate at given x coordinate on that line)

      Because at any given x there might be several or no y if it's a curve. QPainterPath is not a mathematical tool to solve equations.

      You can easily get a point in a distance from one end of the line using percentAtLength() and then feed it into pointAtPercent().

      What functionality are you looking for specifically?

      1 Reply Last reply
      0
      • J Offline
        J Offline
        jcooper
        wrote on last edited by
        #3

        I should be able to add new movable points on the line and model the path between them (straight line, arc, other curve). It would be nice if i can have information about y coordinate of the line at given x. I was thinking about checking QImage for pixels to get this information if there would no other way.

        1 Reply Last reply
        0
        • S Offline
          S Offline
          Salvatello
          wrote on last edited by
          #4

          You want to create a platform to be able to draw and change what you have previously drawn. Want to create a CAD right?

          1 Reply Last reply
          0
          • J Offline
            J Offline
            jcooper
            wrote on last edited by
            #5

            Yes, something like that, but i need only line modeling functionality.

            1 Reply Last reply
            0
            • A Offline
              A Offline
              aliks-os
              wrote on last edited by
              #6

              Look at QGraphicsScene Class. -> addLine

              1 Reply Last reply
              0

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved