Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Intersection of 2 lines
Message
 
À
25/02/2001 20:11:12
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00479322
Message ID:
00479362
Vues:
35
Hi Al, thanks for the help. Quick question (see below in bold).

>>Does anyone have a function that can determine the intersection of 2 lines? I know the start and end points of each line in coordinates (they are 2 element arrays of doubles).
>>
>>tia
>
>I'll give it a shot. I won't use subscripts, so case is important below:
>Suppose line 1 runs from X1,Y1 to X2,Y2 and can be described by the formula
>
>Y = MX + B, then

<b>What is MX? M * one of the X cords?</b>

>
>M = (Y2 - Y1) / (X2 - X1), and
>B = Y1 - MX1

<b> MX1 is M * X1, correct?</b>

>
>Similarly, if line 2 runs from x1,y1 to x2,y2 and can be described by the formula
>
>y = mx + b, then
>
>m = (y2 - y1) / (x2 - x1), and
>b = y1 - mx1
>
>At the point of intersection, y = Y, so
>
>MX + B = mx + b
>
>Also, at the point of intersection x = X, so
>
>MX + B = mX + b
>
>MX - mX = b - B
>
>X(M - m) = b - B
>
>X = (b - B) / (M - m)
>
>Once you have the value of X, you can get the value of Y from the first equation.
Good luck!
Roi
'MCP' Visual FoxPro

In Rome, there was a poem.
About a dog, who found two bone.
He lick the one, he lick the other.
He went pyscho, he drop dead!
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform