Re: [algogeeks] Point lies inside or outside of triangle?

2010-09-21 Thread Bharath
Find area of Triangle(A) and area of Polygon with these four points(B) if AB point lies inside triangle else on if they are equal, it lies on triangle. On Mon, Sep 20, 2010 at 10:39 PM, Nikhil Agarwal wrote: > > Method 1: > Yes you can do by writing equation of 3 lines taking 2 points at a time

Re: [algogeeks] Point lies inside or outside of triangle?

2010-09-21 Thread Nikhil Agarwal
Method 1: Yes you can do by writing equation of 3 lines taking 2 points at a time and finding the sign with the third point. Suppose: ax+by+c=0 is your first line and (x,y) is the third point then find out the sign of the 3rd point satisfying it on the line. suppose this sign is S (for +ve) Simil

Re: [algogeeks] point lies inside or outside of triangle..

2010-09-20 Thread Naveen Agrawal
Take intersection point of triangle as a,b,c And the testing point as p boolean SameSide(p,s,t ,u) if s && p lies on same side //to check same side form equation using t and u and then evaluate the value of point return true//p&s,if both gives same sign(+ve or -ve)

Re: [algogeeks] Point lies inside or outside of triangle?

2010-09-20 Thread umesh kewat
@praveen thanks for ur solution .. but thats a programming que required efficient algo... On Mon, Sep 20, 2010 at 9:06 PM, Praveen Baskar wrote: > here is the hint > we can easily solve this > > draw a triangle > draw a point is inside the triangle > connect the three vertices of the triangle wi

Re: [algogeeks] Point lies inside or outside of triangle?

2010-09-20 Thread Nicolae Titus
there are some approximations involved there, it should be (area(big) - sum(area small)) < error a better approach would be to find if the point is on the proper side of each edge take all the edges clockwise and calculate the sinus between each edge and the point, if they are all positive, the poi

Re: [algogeeks] Point lies inside or outside of triangle?

2010-09-20 Thread saurabh singh
One way would be : Create equation of three sides of the triangle Now check for this point if it lies on left/right of the line (do it for each of the lines)... On Mon, Sep 20, 2010 at 9:06 PM, Praveen Baskar wrote: > here is the hint > we can easily solve this > > draw a triangle > draw a poin

Re: [algogeeks] Point lies inside or outside of triangle?

2010-09-20 Thread Praveen Baskar
here is the hint we can easily solve this draw a triangle draw a point is inside the triangle connect the three vertices of the triangle with this point you will get three small triangle if ( area(big triangle)== sum of area of small triangles) then the point is inside the triangle else it is out

[algogeeks] Point lies inside or outside of triangle?

2010-09-20 Thread umesh
Initially we have given three point A , B, C in plane represent three nodes of triangle, now given another point Z which lies in same plane, find out whether that point lies on/inside the triangle or outside of triangletry to get in minimum time and space complexity -- Thanks & Regards Um

[algogeeks] point lies inside or outside of triangle..

2010-09-20 Thread umesh kewat
Initially we have given three point A , B, C in plane represent three nodes of triangle, now given another point Z which lies in same plane, find out whether that point lies on/inside the triangle or outside of triangletry to get in min time and space complexity -- Thanks & Regards Umesh