📄 cogelevation.cxx
字号:
#include "cogelevation.hxx"CogeometryElevationMap::CogeometryElevationMap(cogIndex lx, cogIndex ly ,cogeometry geom):CogeometryByFunction(*(cogPointToFloat*)this,geom),map(lx,ly),x0(0),y0(0),f0(0),dx(1),dy(1),df(0x7fff){dx /= map.lx(); dy /= map.ly();}CogeometryElevationMap::CogeometryElevationMap(wzString s ,cogeometry geom):CogeometryByFunction(*(cogPointToFloat*)this,geom),map(s),x0(0),y0(0),f0(0),dx(1),dy(1),df(0x7fff){dx /= map.lx(); dy /= map.ly();}wzFloat CogeometryElevationMap::call(const wzPoint& p) const{ cogFloat rx = (p.x()-x0)/dx; cogFloat ry = (p.y()-y0)/dy; cogInteger ix = (cogInteger) rx, jx = ix+1; rx -= ix; cogInteger iy = (cogInteger) ry, jy = iy+1; ry -= iy; if(ix<0){ ix = jx = 0; }else if(jx>=map.lx()){ ix = jx = map.lx()-1; } if(iy<0){ iy = jy = 0; }else if(jy>=map.ly()){ iy = jy = map.ly()-1; } cogFloat uii = map(ix,iy); cogFloat uij = map(ix,jy); cogFloat uji = map(jx,iy); cogFloat ujj = map(jx,jy); cogFloat u = (1-rx)*((1-ry)*uii + ry * uij) + rx*((1-ry)*uji + ry * ujj); return p.z()-(u-f0)/df;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -