Click here to Skip to main content
15,886,786 members
Home / Discussions / C#
   

C#

 
GeneralRe: days of week Pin
mnaveed6-Jan-04 5:52
mnaveed6-Jan-04 5:52 
GeneralCreating CSV files Pin
MrEyes6-Jan-04 0:16
MrEyes6-Jan-04 0:16 
GeneralRe: Creating CSV files Pin
Heath Stewart6-Jan-04 4:26
protectorHeath Stewart6-Jan-04 4:26 
Generalreading from DB Pin
hadi20sa5-Jan-04 22:37
hadi20sa5-Jan-04 22:37 
GeneralRe: reading from DB Pin
Mazdak6-Jan-04 0:35
Mazdak6-Jan-04 0:35 
GeneralRe: reading from DB Pin
Anonymous6-Jan-04 23:18
Anonymous6-Jan-04 23:18 
Questiongetting intercept point of lines?? Pin
azusakt5-Jan-04 22:25
azusakt5-Jan-04 22:25 
AnswerRe: getting intercept point of lines?? Pin
Xiangyang Liu 刘向阳5-Jan-04 23:51
Xiangyang Liu 刘向阳5-Jan-04 23:51 
What you need to do is solving linear equations. As you (may) know from college mathematics, the equation of a straight line on a X-Y plane has the following form:

y = kx + b

unless it is a vertical line, in which case the equation has the form

x = b

Here k and b are constants. If you know the equations of the two lines, then the coordinates of the intersecting point (if exists) will be the solution (x, y) of these two equations. So what you need to do is:

a) Find the equation of the two lines.
b) Determine if they have an intersecting point.
c) Find the intersecting point by solving these two equations for x and y.

a) You need to know two different points on each line. Say (x1, y1) and (x2, y2). If x1 = x2, then the line is vertical, the equation is x = x1. Otherwise, the equation is y = kx + b, where k = (y2-y1)/(x2-x1) and b = y1 - x1(y2-y1)/(x2-x1).

b) Suppose you already have the equations of the two lines: y = k1 x + b1 and y = k2 x + b2. If k1 = k2, then the two lines are parallel (there is not intersecting point). If the two lines are both vertical, then there is no intersecting point either. Otherwise the intersecting point exists (but it may not be on the screen, it may be 200 miles away).

c) After a) and b), you can solve the two equations to get the coordinates of the intersecting point. This is left as an exercise. Wink | ;)

Hope you are not bored with the above lecture. Poke tongue | ;-P

P.S. By the way, this is very fast. Even if you have 100 pairs of lines, the code you write will be executed instantly.





My articles and software tools





Questionhow to change dos prompt caption! Pin
yu-yu5-Jan-04 21:12
yu-yu5-Jan-04 21:12 
AnswerRe: how to change dos prompt caption! Pin
Philip Fitzsimons6-Jan-04 2:54
Philip Fitzsimons6-Jan-04 2:54 
AnswerRe: how to change dos prompt caption! Pin
Heath Stewart6-Jan-04 3:16
protectorHeath Stewart6-Jan-04 3:16 
GeneralRe: how to change dos prompt caption! Pin
Xiangyang Liu 刘向阳6-Jan-04 3:43
Xiangyang Liu 刘向阳6-Jan-04 3:43 
Questionmoving all an app's menus into menus.cs? Pin
TuringTest15-Jan-04 19:56
TuringTest15-Jan-04 19:56 
AnswerRe: moving all an app's menus into menus.cs? Pin
Member 2611885-Jan-04 21:17
Member 2611885-Jan-04 21:17 
AnswerRe: moving all an app's menus into menus.cs? Pin
Heath Stewart6-Jan-04 2:27
protectorHeath Stewart6-Jan-04 2:27 
QuestionFinding a server in a network? Pin
peshkata5-Jan-04 19:40
susspeshkata5-Jan-04 19:40 
AnswerRe: Finding a server in a network? Pin
Mazdak6-Jan-04 0:50
Mazdak6-Jan-04 0:50 
GeneralProper Way To Determine AM or PM Pin
perlmunger5-Jan-04 12:31
perlmunger5-Jan-04 12:31 
GeneralRe: Proper Way To Determine AM or PM Pin
Heath Stewart5-Jan-04 13:44
protectorHeath Stewart5-Jan-04 13:44 
GeneralRe: Proper Way To Determine AM or PM Pin
perlmunger5-Jan-04 17:16
perlmunger5-Jan-04 17:16 
GeneralPractice - Simple COM Interfaces Pin
Tristan Rhodes5-Jan-04 11:43
Tristan Rhodes5-Jan-04 11:43 
GeneralRe: Practice - Simple COM Interfaces Pin
Heath Stewart5-Jan-04 13:40
protectorHeath Stewart5-Jan-04 13:40 
GeneralRe: Practice - Simple COM Interfaces Pin
Tristan Rhodes6-Jan-04 1:13
Tristan Rhodes6-Jan-04 1:13 
GeneralRe: Practice - Simple COM Interfaces Pin
Heath Stewart6-Jan-04 2:21
protectorHeath Stewart6-Jan-04 2:21 
GeneralRe: Practice - Simple COM Interfaces Pin
Tristan Rhodes6-Jan-04 2:32
Tristan Rhodes6-Jan-04 2:32 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.