Code: Select all

screen 12,,2

vp=1

dim as single s,dis4,dis5,dis6,dis8,dis9,disa

'

xp=180:yp=180:zp=100

x1=100:x2=200:x3=100:y1=200:y2=200:y3=100:z1=100:z2=100:z3=100

dis8=sqr((x1-x2)^2+(y1-y2)^2+(z1-z2)^2)

dis9=sqr((x2-x3)^2+(y2-y3)^2+(z2-z3)^2)

disa=sqr((x3-x1)^2+(y3-y1)^2+(z3-z1)^2)

start:

cls

line(x1,y1)-(x2,y2):

line(x2,y2)-(x3,y3)

line(x3,y3)-(x1,y1)

dis4=sqr((x1-xp)^2+(y1-yp)^2+(z1-zp)^2)

dis5=sqr((xp-x2)^2+(yp-y2)^2+(z2-zp)^2)

dis6=sqr((x3-xp)^2+(y3-yp)^2+(z3-zp)^2)

'start:

pset (xp,yp)

k$=inkey$

if k$="d" then xp=xp+1

if k$="s" then xp=xp-1

if k$="e" then yp=yp-1

if k$="x" then yp=yp+1

if k$="q" then zp=zp+1

if k$="a" then zp=zp-1

if k$=chr$(27) then end

locate 1,1

print"press e,x,s,d to move"

locate 15,1:

s=(dis8+dis9+disa)/2

Area=sqr(s*(s-dis8)*(s-dis9)*(s-disa)):'print area''

s=(dis4+dis5+dis8)/2

area1=sqr(s*(s-dis4)*(s-dis5)*(s-dis8)):'print area1

s=(dis5+dis6+dis9)/2

area2=sqr(s*(s-dis5)*(s-dis6)*(s-dis9)):'print area2

s=(dis4+disa+dis6)/2

area3=sqr(s*(s-dis4)*(s-disa)*(s-dis6)):'print area3

line(x1,y1)-(xp,yp),4

line(x2,y2)-(xp,yp),4

line(x3,y3)-(xp,yp),4

print int(area1+area2+area3+.5)

print area

swap vp,wp

screenset wp,vP

goto start