summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan C <ianc@noddybox.co.uk>2005-10-04 00:47:41 +0000
committerIan C <ianc@noddybox.co.uk>2005-10-04 00:47:41 +0000
commitabdcb79b14bb9ff187f6a1fa9258c8bc8afcdbd2 (patch)
tree9d710f8cbcb813bd6ab6956ff9c1d499a183c82d
parent57a46e7b6f61fa750b282ba6ac15b978eebb8335 (diff)
*** empty log message ***
-rw-r--r--algorithm/test.bmx40
1 files changed, 40 insertions, 0 deletions
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