winzip icon

INTERSECTION OF PAIR OF LINES IN THE ORDER OF THE GIVEN SET OF N LINES

Email
Submitted on: 9/7/2015 2:36:59 PM
By: Mr SHINE KADANATTU AYYAPPAN 
Level: Intermediate
User Rating: Unrated
Compatibility: C, C++ (general)
Views: 1857
author picture
 
     I have wrote a C/C++ code to find whether a Given point is inside or Outside of the Triangle Formed by Three points .Now I developed this code to Check whether the point is inside or outside of the Polygon of SIDE n. Sir as you know , the General equation of line be An x + Bn y + C n =0 .We can get a set of lines by putting n=1 to n . Then from a set of n lines I found the intersection of pair of lines in the order of lines given.Now I assumes that these set of n lines forms an n side POLYGON in the given order of lines .I formed a Circular Linked List to store the Coefficients of n lines and their intersection . struct COF is the Coefficients Linked list and strcut POINT is the Linked of List intersected points .First I stored the Coefficients in the linked list found the intersection and stored in point array .then I transferred the point array to POINT linked list .I solved the lines using DETERMINANT METHOD by forming 2X2 Matrix .Now an another point is inputted and using POINT linked list I checked whether the Given point is inside or Outside the Polygon . For Sample: Consider a Rectangle formed by four lines x-4=0 coefficients a=1 b=0 c=-4 , y-6=0 coefficients a=0 b=1 c=-6 , x-8=0 coefficients a=1 b=0 c=-8 and y-2=0 coefficients a=0 b=1 c=-2 and by code I got intersection as (4,6) (8,6) (8,2) and (4,2) . Now I checked for the Points (6,4) inside the rectangle (2,4) outside the rectangle and Result is verified .Now You can use this code for further LPP Development
 
winzip iconDownload code

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. Afterdownloading it, you will need a program like Winzip to decompress it.Virus note:All files are scanned once-a-day by Planet Source Code for viruses, but new viruses come out every day, so no prevention program can catch 100% of them. For your own safety, please:
  1. Re-scan downloaded files using your personal virus checker before using it.
  2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.

If you don't have a virus scanner, you can get one at many places on the net including:McAfee.com


Other 12 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Intermediate category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments


 There are no comments on this submission.
 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.