|
View:
New views
4 Messages
—
Rating Filter:
Alert me
|
|
|
horizontal fovHi Christian,
Another exercise for you... I have tried to calculated the horizontal fov: width,height = pipmak.screensize() vfov_deg = pipmak.getverticalfov() vfov_rad = math.rad(vfov_deg) distance = (height/2)/math.tan(vfov_rad/2)) hfov_rad = 2*math.atan((width/2)/distance)) hfov_deg = math.deg(hfov_rad) but it's not true, because I get an angle lower than what I can measure. What I have forgotten? Thanks Andrea ------------------------------------------------------------------------- Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! Studies have shown that voting for your favorite open source project, along with a healthy diet, reduces your potential for chronic lameness and boredom. Vote Now at http://www.sourceforge.net/community/cca08 _______________________________________________ Pipmak-Users mailing list Pipmak-Users@... news://news.gmane.org/gmane.games.devel.pipmak.user https://lists.sourceforge.net/lists/listinfo/pipmak-users |
|
|
Re: horizontal fovAndrea Viarengo wrote:
> I have tried to calculated the horizontal fov: > > width,height = pipmak.screensize() > vfov_deg = pipmak.getverticalfov() > vfov_rad = math.rad(vfov_deg) > distance = (height/2)/math.tan(vfov_rad/2)) > hfov_rad = 2*math.atan((width/2)/distance)) > hfov_deg = math.deg(hfov_rad) > > but it's not true, because I get an angle lower than what I can measure. That looks correct. What does it give you, and what do you measure, and how? -Christian ------------------------------------------------------------------------- Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! Studies have shown that voting for your favorite open source project, along with a healthy diet, reduces your potential for chronic lameness and boredom. Vote Now at http://www.sourceforge.net/community/cca08 _______________________________________________ Pipmak-Users mailing list Pipmak-Users@... news://news.gmane.org/gmane.games.devel.pipmak.user https://lists.sourceforge.net/lists/listinfo/pipmak-users |
|
|
Re: horizontal fovHi,
Ok, it's correct, because my formula go well only with elevation=0 I believed to found a formula that permit me to put four patches at four angles of the field of view, and I expected (wrong) to view these four images always at the angles of the screen, but this is true only with elevation=0. Ok,ok, it's only an accademic discussion...just to learn.... --------------------------------------------------------------------- -- -- calculate and show fov limits -- ---------------------------------------------------------------------รน side = pipmak.newimage(512,512):color(0,0,1):fill(0,0,512,256) side:color(1,1,1):fill(0,256,512,256) top = pipmak.newimage(512,512):color(0,0,1):fill(0,0,512,512) bottom = pipmak.newimage(512,512):color(1,1,1):fill(0,0,512,512) cubic {side,side,side,side,top,bottom} --------------------------------------------------------------------- function setpos(p,dis,az,el) local nz = -math.cos(math.rad(az))*math.cos(math.rad(el)) local nx = math.sin(math.rad(az))*math.cos(math.rad(el)) local ny = math.sin(math.rad(el)) local dl = math.deg(math.asin(nx)) local bz = math.deg(math.atan2(ny, -nz)) p:move{nx=nx*dis, ny=ny*dis, nz=nz*dis, anglex=bz, angley=-dl} end --------------------------------------------------------------------- function setfovlimits(az,el,di,hdl) local width,height = pipmak.screensize() local vfov_deg = pipmak.getverticalfov() local vfov_rad = math.rad(vfov_deg) local distance = (height/2)/math.tan(vfov_rad/2) local hfov_rad = 2*math.atan((width/2)/distance) local hfov_deg = math.deg(hfov_rad) local az_min = az-hfov_deg/2 local az_max = az+hfov_deg/2 local el_min = el-vfov_deg/2 local el_max = el+vfov_deg/2 hdl:move{az=az_min,el=el_max,w=hfov_deg,h=vfov_deg} setpos(p1,di ,az, el ) setpos(p2,di ,az_min, el ) setpos(p3,di ,az_max, el ) setpos(p4,di ,az, el_min) setpos(p5,di ,az, el_max) pipmak.setviewdirection(az,el) end --------------------------------------------------------------------- az = 90 el = 0 di = 4 hdl = handle{az=0,el=0,w=0,h=0} cross=pipmak.newimage(64,64):fill(30,0,4,64):fill(0,30,64,4) p1=patch{nx=0,ny=0,nz=0,anchorh=32,anchorv=32,w=64,h=64,image=cross } p2=patch{nx=0,ny=0,nz=0,anchorh=32,anchorv=32,w=64,h=64,image=cross } p3=patch{nx=0,ny=0,nz=0,anchorh=32,anchorv=32,w=64,h=64,image=cross } p4=patch{nx=0,ny=0,nz=0,anchorh=32,anchorv=32,w=64,h=64,image=cross } p5=patch{nx=0,ny=0,nz=0,anchorh=32,anchorv=32,w=64,h=64,image=cross } setfovlimits(az,el,di,hdl) pipmak.setshowcontrols(true) onkeydown ( function(key) press="no" if key == pipmak.key_arrow_up then press="yes" el=el+10 end if key == pipmak.key_arrow_down then press="yes" el=el-10 end if press=="yes" then setfovlimits(az,el,di,hdl) return true else pipmak_internal.project.onkeydown(key) return true end end ) --------------------------------------------------------------------- P.S.: I don't remember anymore why I fell in this..... Probably the heat has a bad effect on me.... Bye -Andrea ------------------------------------------------------------------------- Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! Studies have shown that voting for your favorite open source project, along with a healthy diet, reduces your potential for chronic lameness and boredom. Vote Now at http://www.sourceforge.net/community/cca08 _______________________________________________ Pipmak-Users mailing list Pipmak-Users@... news://news.gmane.org/gmane.games.devel.pipmak.user https://lists.sourceforge.net/lists/listinfo/pipmak-users |
|
|
Re: horizontal fovcome to England, we had our summer for 3 days in May! its been wet, cold, windy ever since ![]() |
| Free embeddable forum powered by Nabble | Forum Help |