[futurebasic] Re: Algebra help

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : October 1998 : Group Archive : Group : All Groups

From: Guy Bonnot <bonnot@...>
Date: Fri, 9 Oct 1998 10:15:45 +0200
>
>M# = (By-Ay)/(Bx-Ax)
>Dx = (Cx+((M#^2)*Ax)-(M#*Ay)+(M#*Cy))/((M#^2)+1)
>Dy = (M#*(Dx-Ax))+Ay
>
>PRINT Dx,Dy
>
>Thanks for all the help,
>-Joe Lertola
>
>
>--
Joe
You have to be careful to test before computing M# that Bx<>Ax
in this case the solution is evident (Dx=Ax) but the general algorithm fails.
To speed up the computation, I suggest
long if Ax<>BX
M# = (By-Ay)/(Bx-Ax)
M2#= M#*M#
Dx = (Cx+(M2#*Ax)-(M#*Ay)+(M#*Cy))/(M2#+1)
Dy = (M#*(Dx-Ax))+Ay
xelse
Dx=Ax
Dy=Cy
end if

########################################################
# Guy Bonnot              phone: +33 - 04 72 43 79 82  #
# INRA - INSA               fax: +33 - 04 72 43 85 34  #
# Biologie 406           internet: bonnot@... #
# 20, av. A. Einstein                                  #
# 69621 Villeurbanne cedex                             #
# France                                               #
########################################################