' Challenge of the month November 2012 Triangle area by NaochanON
' X^2+y^2=a^2 ........... ①
' (c-x)^2+y^2=b^2 .......... ②
' ② - ① = (c-x)^2 - x^2 = b^2 - a^2 therefore 2cX=(a^2 -b^2+c^2) ---> X= (a^2 -b^2+c^2) /2c
' Y = sqr(a^2 - x^2)
GraphicsWindow.BackgroundColor="lightcyan"
GraphicsWindow.PenColor="Red"
GraphicsWindow.FontSize=16
GraphicsWindow.Title=" Mark 3 points by using mouse "
GraphicsWindow.MouseDown=mousedown
Sub mousedown
For j=1 To 6
Shapes.Remove(shape[j])
EndFor
MM=MM+1
mxy[MM]="X="+(GraphicsWindow.MouseX)+";Y="+(GraphicsWindow.MouseY) ' mouse X,Y
el[MM]=shapes.AddEllipse(4,4)
shapes.move(el[mm],mxy[mm]["X"]-2,mxy[mm]["Y"]-2) ' point marks
If MM=3 Then
Calc_area()
MM=0
For i=1 To 3
Shapes.Remove(el[i]) ' remove marks
Endfor
EndIf
EndSub