Other Problems

From Hawk Wiki
Revision as of 06:07, 14 November 2012 by Hall (Talk | contribs)

Jump to: navigation, search

Compile glui in windows

download:
http://glui.sourceforge.net/#download
Go to msvc folder and build. A problem you may met:

"There is an incompatibility between glut.h and Visual Studio .NET. that results in compile errors: error C2381: 'exit' : redefinition; __declspec(noreturn) differs error C3861: 'exit': identifier not found, even with argument-dependent lookup

To fix the error, right click on the project name in the Solution Explorer tab and select Properties -> C/C++ -> Preprocessor -> Preprocessor definitions and append GLUT_BUILDING_LIB to the existing definitions, seperated by semicolons. "

Calculate 3D projection 在三维空间中,点到平面的投影

空间点Po(X,Y,Z),以及空间平面(Pp, Np) 其中Pp是平面上任意一点,Np是平面的单位法向量,那么 Po在平面(Pp,Np)上的投影点坐标P = Po - Np * ((Po-Pp)*Np) 理由就是Po到平面的距离就是D=((Po-Pp)*Np),把Po沿着法向量的反方向移动D就可以了

MatLab Code

Po=[5.116,3.769,0.851];
Pa=[3.351,1.419,-1.669];
Pb=[-1.249,2.196,0.851];
Pc=[2.646,0.2,4.054];
Np = cross((Pa-Pb),(Pc-Pb));
Np = Np / norm(Np);
P = Po - Np * ((Po-Pb) * Np');
//P =
//
//    4.1833    0.7237    0.0875