| |
|
|
| Manchmal necessario man normalisierte Punkte einer Linie in skalierbarer Perspektive.
Siehe auch: lineOfNumPoints [...] KompilierenMarkierenSeparieren {$cleq}
cls
showmax
long lops
float fac=0.9
while 1
print fac
case %mousePressed==1 : fac=fac+0.01
case %mousePressed==2 : fac=fac-0.01
lops=lineOfNumTangensPoints(0,0,mousex,mousey,25,fac)
whileloop 1,long(lops,0) {
line 0,long(lops,loop*8+4) - maxx,long(lops,loop*8+4)
}
globalFree(lops)
waitInput 100
cls
wend
end
nProc lineOfNumTangensPoints(long x,y,xx,yy,cnt,float fac){
long data
if cnt>2 {
float fcnt=float(cnt-1),\
sx=float(xx-x),\
sy=float(yy-y),\
px,\
py,\
tmpf=pi()*fac*0.5/float(cnt-2),\
tf=tan(float(cnt-2)*tmpf),\
tmp
data=dim(8+cnt*8)
long data&,0=cnt,0,x,y
sub cnt,2
long offs=16
whileLoop cnt {
tmp=tan(float(loop)*tmpf)/tf
px=sx*tmp
py=sy*tmp
long data&,offs=long(px)+x,long(py)+y
add offs,8
}
long data&,offs=xx,yy
return data
} else if cnt<1 {
data=dim(8)
long data&,0=0
return data
} else if cnt==1 {
data=dim(16)
long data&,0=1,0,long(float(xx-x)*0.5),long(float(yy-y)*0.5)
return data
}
data=dim(24)
long data&,0=1,0,x,y,xx,yy
return data
}
|
|
|
| |
|
|