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. How to find intersection rectitem co ordinates
Forum Updated to NodeBB v4.3 + New Features

How to find intersection rectitem co ordinates

Scheduled Pinned Locked Moved General and Desktop
4 Posts 3 Posters 2.3k 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.
  • M Offline
    M Offline
    mahesh
    wrote on 15 Oct 2011, 12:00 last edited by
    #1

    hi, i have small problem i have one rect angle in horizentel direction rect1(3,3,25,7) and another rectangle in vertical direction rect2(5,5,8,20) rect2 is on rect1 is there any direct function to find the intesected area(it is in rect angle shape) some one please tell me how to find the co ordinates of that rectitem....

    1 Reply Last reply
    0
    • K Offline
      K Offline
      koahnig
      wrote on 15 Oct 2011, 12:15 last edited by
      #2

      Your horizontal item seem to have the coordinates
      rect1 (xmin = 3, ymin = 3, xmax =3+25=28, ymax = 3+7=10)
      the one has
      rect2 (xmin = 5, ymin = 5, xmax =5+8=13, ymax = 5+20=25)
      The maximum rectangle is formed by all "extreme" coordinates:
      rectmax (xmin = 3, ymin = 3, xmax =28, ymax=25)
      The minimum rectangle is formed by
      rectmin(xmin=5,ymin=5,xmax=13,ymax=10)
      I guess you are looking for the later one.
      There are also a number of webpage around to find the proper formulas for none horizotal and vertical lines. "e.g.":http://paulbourke.net/geometry/lineline2d/

      Vote the answer(s) that helped you to solve your issue(s)

      1 Reply Last reply
      0
      • M Offline
        M Offline
        mahesh
        wrote on 15 Oct 2011, 12:28 last edited by
        #3

        thank you so much for your reply ...(3,3,25,7)(x,y,width,height)...the horizental and vertical rect angles are one on the other then some part of area is common for both rectitems it is also in rectangle shape...i want to find that rect angle(x,y,width,height)...

        1 Reply Last reply
        0
        • K Offline
          K Offline
          Kxyu
          wrote on 15 Oct 2011, 14:57 last edited by
          #4

          It's Qt, man! Everything is done for you. Try this :
          @
          QRect rect1(3,3,25,7);
          QRect rect2(5,5,8,29);
          QRect rect3=rect1 & rect2;
          @

          1 Reply Last reply
          0

          3/4

          15 Oct 2011, 12:28

          • Login

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