ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
tip       Ask Questions on ANYTHING, that arise in your Daily Life at     FORUM9.COM
Google
 
Categories >> Code-Snippets >> Programming-Code >> C-Code
 
 
 
Question
How can u say that a given point is in a triangle?
1. with the co-ordinates of the 3 vertices specified.
2. with only the co-ordinates of the top vertex given.
 Question Submitted By :: Vadivel152
I also faced this Question!!     Rank Answer Posted By  
 
Answer
solution for 1st case:
Given:(x1,y1),(x2,y2),(x3,y3),the co-ordinates of the
vertices of the triangle.
 Let (xx,yy) be the pt to be located.
 Find the equations of the lines {(x1,y1),(x2,y2)} and
{(x1,y1)(x3,y3)} using the formula 
((y-y1)/(y2-y1))=((x-x1)/(x2-x1))

 Now substitute the y value  in the 2 equations got. You 'll
be getting the x limits. If the given x value lies within
the limits you have found,the given pt is within the
triangle or else it is not.
 
0
Vadivel
 
View All Answers
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com