📄 cogenelevation.cxx
字号:
#include "cogenelevation.hxx"CogenElevation::CogenElevation(wzString s,cogeometry g) :Geom( new CogeometryElevation(s,g)){geom = Geom;}CogenElevation::CogenElevation(wzString s) :Geom( new CogeometryElevation(s, new Cogeometry1D())){geom = Geom;}void CogenElevation::setBorder(wzFloat xmin,wzFloat xmax, wzFloat ymin,wzFloat ymax, wzFloat zmin,wzFloat zmax){ CogenOctree::setBorder(xmin,xmax,ymin,ymax,0,1); Geom->setOrigin(xmin,ymin,zmin); Geom->setSize(xmax-xmin,ymax-ymin,zmax-zmin);}void CogenElevation::endInitialization(){ CogenOctree::endInitialization(); // Geom->setOrigin(min[0],min[1],0); // Geom->setSize(max[0]-min[0],max[2]-min[1],1);}CogeometryElevation::CogeometryElevation(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();}CogeometryElevation::CogeometryElevation(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 CogeometryElevation::operator()(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 + -