Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Having problem in figuring out the logic (c++)

Having problem in figuring out the logic (c++)

Scheduled Pinned Locked Moved C / C++ / MFC
helpc++algorithmsdata-structuresquestion
7 Posts 3 Posters 0 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.
  • R Offline
    R Offline
    raesa
    wrote on last edited by
    #1

    Hi...i have a small problem and im finding difficult to figure proper algorithm for it, plse help me out.The probelm is explained below: I have a data of a boundary formed by set of 3d(X,Y,Z) points in an array (each point has x,y,z cordinates) and I also have a new point data (x1,y1,z1).My problem is i have to find out if this new point falls with in the boundary of set of points. I am not able to figure out proper logic for this.Can somebody help me out? Plse do help me. Thnx in advance.

    C 1 Reply Last reply
    0
    • R raesa

      Hi...i have a small problem and im finding difficult to figure proper algorithm for it, plse help me out.The probelm is explained below: I have a data of a boundary formed by set of 3d(X,Y,Z) points in an array (each point has x,y,z cordinates) and I also have a new point data (x1,y1,z1).My problem is i have to find out if this new point falls with in the boundary of set of points. I am not able to figure out proper logic for this.Can somebody help me out? Plse do help me. Thnx in advance.

      C Offline
      C Offline
      Cedric Moonen
      wrote on last edited by
      #2

      raesa wrote:

      I have a data of a boundary formed by set of 3d(X,Y,Z) points in an array

      Does it have any specific shape ? Because if not, this will probably be very difficult because if you have a 'random'cloud of points, it is quite impossible to make a boundary out of that.

      Cédric Moonen Software developer
      Charting control [v1.5 - Updated] OpenGL game tutorial in C++

      R 1 Reply Last reply
      0
      • C Cedric Moonen

        raesa wrote:

        I have a data of a boundary formed by set of 3d(X,Y,Z) points in an array

        Does it have any specific shape ? Because if not, this will probably be very difficult because if you have a 'random'cloud of points, it is quite impossible to make a boundary out of that.

        Cédric Moonen Software developer
        Charting control [v1.5 - Updated] OpenGL game tutorial in C++

        R Offline
        R Offline
        raesa
        wrote on last edited by
        #3

        Thnx for the reply.As you said these points are scattered all over the space and the boundary formed by these points might not be closed a one.i want to find out if my new point lies with in this point cloud or not.Is it possible?? Plse do help me out.

        C 1 Reply Last reply
        0
        • R raesa

          Thnx for the reply.As you said these points are scattered all over the space and the boundary formed by these points might not be closed a one.i want to find out if my new point lies with in this point cloud or not.Is it possible?? Plse do help me out.

          C Offline
          C Offline
          Cedric Moonen
          wrote on last edited by
          #4

          Well it depends a lot of your requirements. You can maybe simply check the min/max values for the X, Y and Z axis and so have a 3D rectangle which is the boundary of your points cloud. That should be easy to do (walk over all the points and take the min/max for the 3 dimensions). Then checking if a new point is inside that is quite easy. But does that work with your requirement ? What do you need to do exactly ?

          Cédric Moonen Software developer
          Charting control [v1.5 - Updated] OpenGL game tutorial in C++

          R 1 Reply Last reply
          0
          • C Cedric Moonen

            Well it depends a lot of your requirements. You can maybe simply check the min/max values for the X, Y and Z axis and so have a 3D rectangle which is the boundary of your points cloud. That should be easy to do (walk over all the points and take the min/max for the 3 dimensions). Then checking if a new point is inside that is quite easy. But does that work with your requirement ? What do you need to do exactly ?

            Cédric Moonen Software developer
            Charting control [v1.5 - Updated] OpenGL game tutorial in C++

            R Offline
            R Offline
            raesa
            wrote on last edited by
            #5

            I thank you very much, once again.Well, i need to find out if my point lies inside or outside the boundary (or point cloud) formed by the availables set of points. If i take the min/max of all the three dimesnsions(x,y&z) i might get 6 different points (3points for minimum values of x/y/z and 3 for maximum values of x/y/z), right? Do you suggest me that i will have to compare and find out if my new point cordinates(x1, y1, z1) is either greater or less than the any of the (x,y,z)values of the 6 points? Which means that if any one value (either x1/y1/z1) is greater than the (x/y/z) of the 6 points, the new point lies outside the point cloud. Plse do tell me if i my understanding of the method you suggested is right. Thank You.

            O 1 Reply Last reply
            0
            • R raesa

              I thank you very much, once again.Well, i need to find out if my point lies inside or outside the boundary (or point cloud) formed by the availables set of points. If i take the min/max of all the three dimesnsions(x,y&z) i might get 6 different points (3points for minimum values of x/y/z and 3 for maximum values of x/y/z), right? Do you suggest me that i will have to compare and find out if my new point cordinates(x1, y1, z1) is either greater or less than the any of the (x,y,z)values of the 6 points? Which means that if any one value (either x1/y1/z1) is greater than the (x/y/z) of the 6 points, the new point lies outside the point cloud. Plse do tell me if i my understanding of the method you suggested is right. Thank You.

              O Offline
              O Offline
              oobimoo
              wrote on last edited by
              #6

              raesa wrote:

              If i take the min/max of all the three dimesnsions(x,y&z) i might get 6 different points (3points for minimum values of x/y/z and 3 for maximum values of x/y/z), right? Do you suggest me that i will have to compare and find out if my new point cordinates(x1, y1, z1) is either greater or less than the any of the (x,y,z)values of the 6 points? Which means that if any one value (either x1/y1/z1) is greater than the (x/y/z) of the 6 points, the new point lies outside the point cloud.

              What I understood, is that Cedric suggested to test if the point p(x,y,z) is in the bounding box of this set of points. And you do this by just comparing if((x>=XMIN)&&(x<=XMAX)&&(y>=YMIN)&&(y<=YMAX)&&(z>=ZMIN)&&(z<=ZMAX)). So, if by the word "cloud" you mean bounding box, it's ok. If you mean "convex hull" it's a quite different problem. And although the 2d version of this problem is a common topic for an introductive to algorithms class, I don’t know much about the 3d case. Definitely this question belongs in an algorithms forum. Meanwhile search for “convex hull from set of 3d points”, and “point in convex hull of 3d points” algorithms. my intuition: linear programming problem

              modified on Thursday, August 28, 2008 1:56 PM

              R 1 Reply Last reply
              0
              • O oobimoo

                raesa wrote:

                If i take the min/max of all the three dimesnsions(x,y&z) i might get 6 different points (3points for minimum values of x/y/z and 3 for maximum values of x/y/z), right? Do you suggest me that i will have to compare and find out if my new point cordinates(x1, y1, z1) is either greater or less than the any of the (x,y,z)values of the 6 points? Which means that if any one value (either x1/y1/z1) is greater than the (x/y/z) of the 6 points, the new point lies outside the point cloud.

                What I understood, is that Cedric suggested to test if the point p(x,y,z) is in the bounding box of this set of points. And you do this by just comparing if((x>=XMIN)&&(x<=XMAX)&&(y>=YMIN)&&(y<=YMAX)&&(z>=ZMIN)&&(z<=ZMAX)). So, if by the word "cloud" you mean bounding box, it's ok. If you mean "convex hull" it's a quite different problem. And although the 2d version of this problem is a common topic for an introductive to algorithms class, I don’t know much about the 3d case. Definitely this question belongs in an algorithms forum. Meanwhile search for “convex hull from set of 3d points”, and “point in convex hull of 3d points” algorithms. my intuition: linear programming problem

                modified on Thursday, August 28, 2008 1:56 PM

                R Offline
                R Offline
                raesa
                wrote on last edited by
                #7

                Thnx for the help.I'll check out the logic you suggested but i have doubt if it will work fine if the point is very close to the point cloud.Thnx anyways and i'll get back if i am stuck up somewhere.Thnx again.

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups