⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cogenpixmap.cxx

📁 Delaunay三角形的网格剖分程序
💻 CXX
字号:
#include "cogenpixmap.hxx"#include "cogwarnings.hxx"// #include "wzoutput.hxx"void CogenPixmap::endInitialization(){  wzFloat dd;  // wzOutput& pout = wzOutput::Default;  if(dirx * diry){    if(mod){cogInfoBadPixmapParameters();}  }else if(dirx){    dd = pixmap.ly()*(xp-xm)/pixmap.lx();    if(mod==3)        {yp = a; ym = a - dd;}    else if(mod==2)   {ym = a - dd/2; yp = a + dd/2;}    else              {ym = a; yp = a + dd;}  }else if(diry){    dd = pixmap.lx()*(yp-ym)/pixmap.ly();    if(mod==3)        {xp = a; xm = a - dd;}    else if(mod==2)   {xm = a - dd/2; xp = a + dd/2;}    else              {xm = a; xp = a + dd;}  }else{    xm = 0; xp = 1;    dd = pixmap.ly()*(1.0/pixmap.lx());    if(mod==3)        {yp = a; ym = a - dd;}    else if(mod==2)   {ym = a - dd/2; yp = a + dd/2;}    else              {ym = a; yp = a + dd;}  }  dx = (xp-xm)/pixmap.lx();  dy = (yp-ym)/pixmap.ly();  setBorder(xm,xp, ym,yp);  //  pout("pixmap [<>,<>]x[<>,<>]\n")<<xm,xp,ym,yp;  CogenOctree::endInitialization();}cogIndex CogenPixmap::Point( cogPoint& p0) const{// computation of the segment number for the point (x[0],x[1]): cogFloat rx,ry; int ix = (int)((rx = (p0.x() - xm) / (dx))); int iy = (int)((ry = (p0.y() - ym) / (dy))); int lx = pixmap.lx(); int ly = pixmap.ly(); int u00,u01,u10,jx,jy; rx -= ix; ry -= iy; if(ix<0) {ix = 0; rx = 0;} else if(ix>=lx) {ix = lx - 1; rx = 1;} if(iy<0) {iy = 0; ry = 0;} else if(iy>=ly) {iy = ly - 1; ry = 1;} u00 = pixmap(ix,iy); if(cutPixelCorner){   if(rx > 0.5) {jx = ix+1; rx -= 0.5;}	else {jx = ix-1; rx = 0.5-rx;}   if(ry > 0.5) {jy = iy+1; ry -= 0.5;}	else {jy = iy-1; ry = 0.5-ry;}   if(jx<0) jx = 0;	else if(jx>=lx) jx = lx - 1;   if(jy<0) jy = 0;	else if(jy>=ly) jy = ly - 1;   u01 = pixmap(ix,jy);   u10 = pixmap(jx,iy);   if(u10 == u01)	if(rx+ry > 0.5) u00 = u10; } p0.segment() = wzRegion(u00); return cogRCRegionFound;}CogenPixmap::CogenPixmap(cogName f, int maxcolors):pixmap((wzString)f,maxcolors),cutPixelCorner(0),mod(0),dirx(0),diry(0),a(0){}void CogenPixmap::alignCenter (wzFloat x) {a = x; mod = 2;}void CogenPixmap::alignMinimum(wzFloat x) {a = x; mod = 1;}void CogenPixmap::alignMaximum(wzFloat x) {a = x; mod = 3;}void CogenPixmap::setHorizontal(wzFloat min, wzFloat max){xm = min; xp = max; dirx = 1;}void CogenPixmap::setVertical(wzFloat min, wzFloat max){ym = min; yp = max; diry = 1;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -