Math wizardry

Richard Miller wow at together.net
Wed Mar 2 20:32:45 EST 2005


Thanks Richard and Jim for the math. I suspect I'll have questions for 
one or both of you shortly.

Richard Miller



On Mar 2, 2005, at 12:51 PM, Richard K. Herz wrote:

> Richard Miller asked:
>> I've got two line graphics drawn on the screen. I need to find out if
>> they intersect and, if so, what the angle is that is formed by their
>> intersection. Any simple way to do this?
>
> See, e.g.,
> http://www.ugrad.math.ubc.ca/coursedoc/math100/notes/zoo/eqline.html
> for each line defined by endpoints x1,y1 and x2,y2
> st line equation y = m*x + b (m = slope, b = y intercept at x = 0)
> m = (y2 - y1)/(x2 - x1) = slope of line
> b = y1 - m*x1 = intersection of line with y axis at x = 0
> for two lines, get m1 and m2, b1 and b2
> Any two nonparallel lines (m1 not m2) intersect
> find x such that y's are equal
> m1*x + b1 = m2*x + b2
> x = (b2 - b1)/(m1 - m2)  = x at intersection
> y at intersection = m1*x + b1 = m2*x + b2
> slope m1 = tangent of angle A1 between line 1 and x-axis
> angle A1 = inverse tangent(m1) = atan(m1) in Rev
> angle A2 = inverse tangent(m2)
> see http://www.mathwords.com/t/tangent_inverse.htm
> A2 - A1 = one pair of the two pairs of angles formed by the 
> intersection of
> two straight lines, with the other pair being pi radians (180 degrees) 
> minus
> this angle
> Note that Rev and most other languages refer to angles in radians 
> rather
> than degrees in their trig functions.
> Of course, work out a few examples and graph them to double-check this 
> and
> to understand the angle values returned.
>
> Rich Herz
> herz at ucsd.edu
>
>
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/use-revolution
>



More information about the Use-livecode mailing list