From abdcb79b14bb9ff187f6a1fa9258c8bc8afcdbd2 Mon Sep 17 00:00:00 2001 From: Ian C Date: Tue, 4 Oct 2005 00:47:41 +0000 Subject: *** empty log message *** --- algorithm/test.bmx | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/algorithm/test.bmx b/algorithm/test.bmx index 60ce813..1da25c3 100644 --- a/algorithm/test.bmx +++ b/algorithm/test.bmx @@ -7,10 +7,20 @@ Const SCRH=600 SetGraphicsDriver GLMax2DDriver() Graphics SCRW,SCRH,32,60' Or HARDSYNC +HideMouse() + +Local x1:Int=200 +Local x2:Int=600 +Local y1:Int=500 +Local y2:Int=100 + +Local yi:Int=-1 +Local xi:Int=1 While Not KeyHit(KEY_ESCAPE) Cls + Rem Local l:TList=DoLine(Rand(0,SCRW),Rand(0,SCRH),Rand(0,SCRW),Rand(0,SCRH)) For Local p:TAlgoPoint=EachIn l @@ -26,6 +36,36 @@ While Not KeyHit(KEY_ESCAPE) SetColor(Rand(100,255),Rand(100,255),Rand(100,255)) DrawLine(pa[f].x,pa[f].y,pa[nf].x,pa[nf].y) Next + EndRem + + SetColor(255,0,0) + DrawLine(x1,y1,x2,y2) + + 'x1:+xi + 'x2:-xi + 'y1:+yi + 'y2:-yi + + If x1=200 Or x1=600 + xi=-xi + EndIf + + If y1=100 Or y1=500 + yi=-yi + EndIf + + SetColor(0,0,255) + DrawOval(MouseX()-10,MouseY()-10,20,20) + + SetColor(255,255,255) + Local pl:TAlgoPoint3D[]=CircleIntersects(x1,y1,0,x2,y2,0,MouseX(),MouseY(),0,10) + Local y:Int=50 + + For Local p:TAlgoPoint3D=EachIn pl + DrawText(p.x+","+p.y,0,y) + y:+10 + Plot(p.x,p.y) + Next Flip FlushMem -- cgit v1.2.3