Creating 'Conic Projections'.
I take a suitable image, and create a grey-scale version, then re-map it so it will look correct when viewed as a 3D cone when seen face-on, and distorted by various amounts from other directions.
global pi
pi =3.14159265
WindowWidth =810
WindowHeight =638
graphicbox #w.gb 2, 2, 200, 200
nomainwin
open "Inverse circle image" for graphics_nsb_nf as #w
#w "trapclose [quit]"
#w.gb "down ; fill black ; size 2"
handleg =hwnd( #w.gb)
calldll #user32, "GetDC", handleg as ulong, hDC as ulong
#w.gb "down"
image$ ="circle6.bmp"
loadbmp "target", image$
#w.gb "drawbmp target 0 0 ; flush ; size 2"
for y =0 to 200 step 1
for x =201 to 600 step 1
radius =( ( x -400)^2 +( 200 -y)^2)^0.5
if ( x =400) and ( y =200) then [skip]
theta =ATAN2( y -100, x -300)
thetaNew =theta /2
xx =int( 100 +radius *cos( thetaNew))
yy =int( 100 +radius *sin( thetaNew))
calldll #gdi32, "GetPixel", hDC as ulong, xx as long, yy as long, pixcol as ulong
bl = int( pixcol /( 256*256)): gr = int( (pixcol -bl *256*256) / 256): re = int( pixcol -bl *256*256 -gr *256)
#w.gb "color "; str$( re) +" " +str$( gr) +" " +str$( bl)
#w.gb "set "; int( xx); " "; 600 -int( yy)
scan
[skip]
next x
next y
#w.gb "flush"
#w.gb "getbmp scr 0 0 600 600"
bmpsave "scr", word$( image$, 1, ".") +"Invd.bmp"
wait
[quit]
callDll #user32, "ReleaseDC", handleg as ulong, hDC as ulong, result as ushort
close #w
end
function ATAN2( y, x)
pi = atn( 1 ) *4
Result$ = "Undetermined"
If ( x =0) and ( y >0) then ATAN2 = pi /2: Result$ ="Determined"
if ( x =0) and ( y <0) then ATAN2 =3 * pi /2: Result$ ="Determined"
if ( x >0) and ( y =0) then ATAN2 =0: Result$ ="Determined"
if ( x <0) and ( y =0) then ATAN2 =pi: Result$ ="Determined"
If Result$ <>"Determined" then
BaseAngle =ATN( abs( y) /abs( x))
If ( x >0) and ( y >0) then ATAN2 = BaseAngle
If ( x <0) and ( y >0) then ATAN2 = pi -BaseAngle
If ( x <0) and ( y <0) then ATAN2 = pi +BaseAngle
If ( x >0) and ( y <0) then ATAN2 = 2*pi -BaseAngle
end if
End Function