1. Not finding help here? Sign up for a free 30min tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Coordinates given, find whether a point is inside or outside

  1. Dec 6, 2006 #1
    I'm supposed to derive an equation that will find whether or not a point is inside or outside a shape with only the coordinates of the vertices given.

    The shape is expected to be something like this:

    ______
    |........|.........._____
    |........|______|.......|
    |............................|_____
    |.....................................|
    |.....................................|
    |...........___________.........|
    |..........|.................|........|
    |______|..................|_____|

    with the coordinates of the corners given. The shape isn't exactly that but it's basically a collection of boxes.

    I really have no idea where to start, if anyone could give me a starting point I'd appreciate it.

    Thanks.
     
  2. jcsd
  3. Dec 6, 2006 #2
    Write one variable as a function of the other. So y = x^2, or whatever.
     
  4. Dec 10, 2006 #3
    KoGs is right, you do need a function. I would recommend starting with a distance formula, and creating a convention (+ inside object, - outside object). The real problem is that you'll need to subdivide your object into smaller, reasonable pieces. Create perimeter bounds for each of these shapes, and then do the necessary distance calculations. At the end, you will have to compare to make sure you don't have any overlap in your data set -> Sum Individual Data Sets - Union of Data Sets
    Another way to tackle this is scan whole object into a matrix, fill the shape, tag inside to be 1's, and then outside to be 0's (null/void). Then apply a particle analysis to see if your point lands on empty or full space in your matrix.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?



Similar Discussions: Coordinates given, find whether a point is inside or outside
Loading...