資源簡介
很不錯的資源啊。。歡迎大家來下載。基于VC++的圖像修復(fù)源代碼

代碼片段和文件信息
//?amera.cpp:?implementation?of?the?Camera?class.
//
//////////////////////////////////////////////////////////////////////
#include?“stdafx.h“
#include?“FastRBF.h“
#include?“amera.h“
#include?
#include?
#include?
//#include?
using?std::swap;
#ifdef?_DEBUG
#undef?THIS_FILE
static?char?THIS_FILE[]=__FILE__;
#define?new?DEBUG_NEW
#endif
//?Radius?of?trackball
#define?TRACKBALL_R?0.85f
//?Initial?field?of?view?of?the?camera
#define?DEFAULT_FOV?0.8284271f
#define?M_PI?3.14159265358979323846
//////////////////////////////////////////////////////////////////////
//?Construction/Destruction
//////////////////////////////////////////////////////////////////////
Camera::Camera()
{
Init();?
}
Camera::~Camera()
{
}
//?Initialize?parameters?of?the?camera?to?the?usual
//?(i.e.?at?origin?looking?down?negative?Z?axis?etc.)
void?Camera::Init()
{
pos[0]?=?homepos[0]?=?savepos[0]?=?0;
pos[1]?=?homepos[1]?=?savepos[1]?=?0;
pos[2]?=?homepos[2]?=?savepos[2]?=?0;
rot?=?homerot?=?saverot?=?0;
rotaxis[0]?=?homerotaxis[0]?=?saverotaxis[0]?=?0;
rotaxis[1]?=?homerotaxis[1]?=?saverotaxis[1]?=?0;
rotaxis[2]?=?homerotaxis[2]?=?saverotaxis[2]?=?1;
fov?=?homefov?=?savefov?=?DEFAULT_FOV;
}
//?Set?the?“home“?position?of?the?camera
void?Camera::SetHome(const?float?*_pos
?????float?_rot
?????const?float?*_rotaxis
?????float?_fov)
{
homepos[0]?=?_pos[0];?homepos[1]?=?_pos[1];?homepos[2]?=?_pos[2];
homerot?=?_rot;
homerotaxis[0]?=?_rotaxis[0];?homerotaxis[1]?=?_rotaxis[1];?homerotaxis[2]?=?_rotaxis[2];
homefov?=?_fov;
}
//?Set?the?“home“?position?of?the?camera?by?reading?it?from?a?.xf?file?that
//?specifies?a?transformation?matrix
bool?Camera::SetHome(const?char?*filename)
{
FILE?*f?=?fopen(filename?“r“);
if?(!f)
return?false;
float?M[16];
for?(int?i=0;?i?4;?i++)
for?(int?j=0;?j?4;?j++)
fscanf(f?“%f“?M+i+4*j);
fclose(f);
//?Matrix?->?Quat?from?GGems?IV?III.4?(Ken?Shoemake)
//?and?Xform.h?(Kari?Pulli)
quat?q;
float?tr?=?M[0]?+?M[5]?+?M[10];
if?(tr?>=?0.0f)?{
float?s?=?sqrtf(tr?+?M[15]);
q[0]?=?s?*?0.5f;
s?=?0.5f?/?s;
q[1]?=?(M[4*1+2]?-?M[4*2+1])?*?s;
q[2]?=?(M[4*2+0]?-?M[4*0+2])?*?s;
q[3]?=?(M[4*0+1]?-?M[4*1+0])?*?s;
}?else?{
int?i=0;
if?(M[5]?>?M[0])
i?=?1;
if?(M[10]?>?M[5*i])
i?=?2;
int?j?=?(i+1)?%?3;
int?k?=?(j+1)?%?3;
float?s?=?sqrtf(M[15]?+?M[5*i]?-?M[5*j]?-?M[5*k]);
q[i+1]?=?0.5f?*?s;
s?=?0.5f?/?s;
q[j+1]?=?(M[4*i+j]?+?M[4*j+i])?*?s;
q[0]???=?(M[4*j+k]?-?M[4*k+j])?*?s;
q[k+1]?=?(M[4*k+i]?+?M[4*i+k])?*?s;
}
QNorm(q);
Q2RotAndAxis(q?homerot?homerotaxis);
homepos[0]?=?-(M[12]*M[0]?+?M[13]*M[4]?+?M[14]*M[8]);
homepos[1]?=?-(M[12]*M[1]?+?M[13]*M[5]?+?M[14]*M[9]);
homepos[2]?=?-(M[12]*M[2]?+?M[13]*M[6]?+?M[14]*M[10]);
homefov?=?DEFAULT_FOV;
return?true;
}
//?Reset?the?camera?to?the?“home“?position
void?
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄??????????0??2005-06-13?15:11??RBFInpainting
?????文件???????9762??2004-02-27?22:08??RBFInpainting\amera.cpp
?????文件???????1712??2004-02-27?22:04??RBFInpainting\amera.h
?????文件???????4676??2004-03-11?11:20??RBFInpainting\AxisKdTree.cpp
?????文件???????2692??2004-03-11?11:19??RBFInpainting\AxisKdTree.h
?????文件?????345474??2004-02-28?21:55??RBFInpainting\background.bmp
?????文件???????9829??2004-03-12?18:51??RBFInpainting\BallController.cpp
?????文件???????4822??2004-03-12?18:50??RBFInpainting\BallController.h
?????文件??????22386??2004-03-10?14:47??RBFInpainting\Bloomenthal.cpp
?????文件???????7949??2003-11-29?15:24??RBFInpainting\Bloomenthal.h
?????文件??????34398??2004-03-17?20:28??RBFInpainting\BMPImage.cpp
?????文件???????2144??2004-03-17?19:19??RBFInpainting\BMPImage.h
?????文件???????1477??2003-11-24?14:23??RBFInpainting\ChildFrm.cpp
?????文件???????1329??2003-11-24?14:22??RBFInpainting\ChildFrm.h
?????文件??????71273??2004-04-02?13:58??RBFInpainting\Dib.cpp
?????文件???????6800??2004-04-02?13:58??RBFInpainting\Dib.h
?????文件??????28646??2004-03-30?15:46??RBFInpainting\ell.cpp
?????文件???????2337??2004-03-30?15:46??RBFInpainting\ell.h
?????文件??????51660??2005-06-03?00:45??RBFInpainting\FastRBF.aps
?????文件???????5334??2005-06-03?00:52??RBFInpainting\FastRBF.clw
?????文件???????4651??2004-05-25?21:11??RBFInpainting\FastRBF.cpp
?????文件???????7096??2005-03-28?16:31??RBFInpainting\FastRBF.dsp
?????文件????????838??2005-03-28?16:22??RBFInpainting\FastRBF.dsw
?????文件???????1397??2004-03-13?11:29??RBFInpainting\FastRBF.h
?????文件?????984064??2005-06-03?00:52??RBFInpainting\FastRBF.ncb
?????文件?????269824??2005-06-03?00:52??RBFInpainting\FastRBF.opt
?????文件???????1419??2005-06-03?00:45??RBFInpainting\FastRBF.plg
?????文件??????16883??2005-06-03?00:45??RBFInpainting\FastRBF.rc
?????文件??????32753??2004-04-10?10:06??RBFInpainting\FastRBFDoc.cpp
?????文件???????3485??2004-04-09?17:12??RBFInpainting\FastRBFDoc.h
............此處省略67個文件信息
- 上一篇:Google C++編碼規(guī)范
- 下一篇:vc++FTP搜索工具()
評論
共有 條評論