15,964,117 members
Home / Discussions / C#

C#

 Re: days of week mnaveed6-Jan-04 5:52 mnaveed 6-Jan-04 5:52
 Creating CSV files MrEyes6-Jan-04 0:16 MrEyes 6-Jan-04 0:16
 Re: Creating CSV files Heath Stewart6-Jan-04 4:26 Heath Stewart 6-Jan-04 4:26
 Re: reading from DB Mazdak6-Jan-04 0:35 Mazdak 6-Jan-04 0:35
 Re: reading from DB Anonymous6-Jan-04 23:18 Anonymous 6-Jan-04 23:18
 getting intercept point of lines?? azusakt5-Jan-04 22:25 azusakt 5-Jan-04 22:25
 Re: getting intercept point of lines?? 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. Hope you are not bored with the above lecture. 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
 how to change dos prompt caption! yu-yu5-Jan-04 21:12 yu-yu 5-Jan-04 21:12
 Re: how to change dos prompt caption! Philip Fitzsimons6-Jan-04 2:54 Philip Fitzsimons 6-Jan-04 2:54
 Re: how to change dos prompt caption! Heath Stewart6-Jan-04 3:16 Heath Stewart 6-Jan-04 3:16
 Re: how to change dos prompt caption! Xiangyang Liu 刘向阳6-Jan-04 3:43 Xiangyang Liu 刘向阳 6-Jan-04 3:43
 moving all an app's menus into menus.cs? TuringTest15-Jan-04 19:56 TuringTest1 5-Jan-04 19:56
 Re: moving all an app's menus into menus.cs? Member 2611885-Jan-04 21:17 Member 261188 5-Jan-04 21:17
 Re: moving all an app's menus into menus.cs? Heath Stewart6-Jan-04 2:27 Heath Stewart 6-Jan-04 2:27
 Finding a server in a network? peshkata5-Jan-04 19:40 peshkata 5-Jan-04 19:40
 Re: Finding a server in a network? Mazdak6-Jan-04 0:50 Mazdak 6-Jan-04 0:50
 Proper Way To Determine AM or PM perlmunger5-Jan-04 12:31 perlmunger 5-Jan-04 12:31
 Re: Proper Way To Determine AM or PM Heath Stewart5-Jan-04 13:44 Heath Stewart 5-Jan-04 13:44
 Re: Proper Way To Determine AM or PM perlmunger5-Jan-04 17:16 perlmunger 5-Jan-04 17:16
 Practice - Simple COM Interfaces Tristan Rhodes5-Jan-04 11:43 Tristan Rhodes 5-Jan-04 11:43
 Re: Practice - Simple COM Interfaces Heath Stewart5-Jan-04 13:40 Heath Stewart 5-Jan-04 13:40
 Re: Practice - Simple COM Interfaces Tristan Rhodes6-Jan-04 1:13 Tristan Rhodes 6-Jan-04 1:13
 Re: Practice - Simple COM Interfaces Heath Stewart6-Jan-04 2:21 Heath Stewart 6-Jan-04 2:21
 Re: Practice - Simple COM Interfaces Tristan Rhodes6-Jan-04 2:32 Tristan Rhodes 6-Jan-04 2:32
 Last Visit: 31-Dec-99 18:00     Last Update: 10-Aug-24 10:13 Refresh ᐊ Prev1...14294142951429614297142981429914300143011430214303 Next ᐅ