|
|||||||
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
#1 | ||
|
Its the Dark Side!
|
Well im making a proggy which draws lines. I need to find out how to make the program find the Point Of Intersection between two intersecting lines (usind the VB Line Control). Any VB Masters who would know how to accomplish this?
![]() Thanks in advance
__________________
CN ![]()
|
||
|
|
|
|
|
#2 |
|
Registered User
Join Date: Nov 2001
Posts: 1,965
|
I haven't used VB for ages, but I think your problem isn't related to VB, it's a math problem, you have 2 lines, and you want to calculate the point of intersection between them.
What info do you have about the line? 2 points? 1 point and slope? Or what? |
|
|
|
|
|
#3 |
|
Its the Dark Side!
|
well ive got the slope of the lines. and since im dealing with VB i know the X1 Y1, and X2 Y2 Coordinates of each line. btw, the slopes of the lines are stored in an array called slope(n) (n is the array #. every time i draw a line, its slope info is stored in its respective slope array spot. My theory is to have VB Trace the lines and once both traces hit the same number, that would be the intersect
|
|
|
|
|
|
#4 |
|
Professional gadfly
|
It's a math problem, so treat it as such. "Tracing" the lines or otherwise fiddling with graphical solutions will be far slower and cumbersome.
If (X1,Y1) is a point on a line of slope S1, and (X2,Y2) is a point on a line of slope S2, then the x-coordinate where they intersect is: ((S1*X1 + Y2) - (S2*X2 + Y1))/(S1-S2) The y-coordinate can be found after you have the x-coordinate with: S1*(X-X1)+Y1 |
|
|
|
|
|
#5 |
|
Its the Dark Side!
|
Alright, ill try that. hopefully itll work with my code
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|