Coordinates given, find whether a point is inside or outside

glid02
Messages
54
Reaction score
0
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.
 
Physics news on Phys.org
Write one variable as a function of the other. So y = x^2, or whatever.
 
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.
 
There are two things I don't understand about this problem. First, when finding the nth root of a number, there should in theory be n solutions. However, the formula produces n+1 roots. Here is how. The first root is simply ##\left(r\right)^{\left(\frac{1}{n}\right)}##. Then you multiply this first root by n additional expressions given by the formula, as you go through k=0,1,...n-1. So you end up with n+1 roots, which cannot be correct. Let me illustrate what I mean. For this...
Back
Top