Posted: 9th Apr 2004 23:22
this snippet finds the halfway point between to coordinants.



+ Code Snippet
dstx#=sqrt((xa#-xb#)^2)
dsty#=sqrt((ya#-yb#)^2)
dstz#=sqrt((za#-zb#)^2)

if xa#<xb# then centerx#=xa#+xb# else centerx#=xa#-xb#
if ya#<yb# then centery#=ya#+yb# else centery#=ya#-yb#
if za#<zb# then centerz#=za#+zb# else centerz#=za#-zb# 


below is a simple test program, the variable names are different and it's 2d. (to make the above 2d remove all references to the z plain.)

+ Code Snippet
do
do
if mouseclick()=1 then x1=mousex():y1=mousey():exit
loop
circle x1,y1,5
wait (250)
do
if mouseclick()=1 then x2=mousex():y2=mousey():exit
loop
circle x2,y2,5
wait (250)
yd=sqrt((y1-y2)^2)/2
xd=sqrt((x1-x2)^2)/2
if x1<x2 then theplacex=x1+xd else theplacex=x1-xd
if y1<y2 then theplacey=y1+yd else theplacey=y1-yd
circle theplacex,theplacey,3
print "Strike any key to continue."
wait key
cls
loop
Posted: 9th Apr 2004 23:40
??????

What's wrong with just:
centerx=(x1+x2)/2.0
centery=(y1+y2)/2.0

Kevil