资源简介
课程的大作业,欧拉操作的代码,希望给大家带来帮助
代码片段和文件信息
/** KempoApi: The Turloc Toolkit *****************************/
/** * * **/
/** ** ** Filename: ArcBall.cpp **/
/** ** Version: Common **/
/** ** **/
/** **/
/** Arcball class for mouse manipulation. **/
/** **/
/** **/
/** **/
/** **/
/** (C) 1999-2003 Tatewake.com **/
/** History: **/
/** 08/17/2003 - (TJG) - Creation **/
/** 09/23/2003 - (TJG) - Bug fix and optimization **/
/** 09/25/2003 - (TJG) - Version for NeHe basecode users **/
/** **/
/*************************************************************/
#include “ArcBall.h“ // ArcBall header
//Arcball sphere constants:
//Diameter is 2.0f
//Radius is 1.0f
//Radius squared is 1.0f
void ArcBall_t::_mapToSphere(const Point2fT* NewPt Vector3fT* NewVec) const
{
Point2fT TempPt;
GLfloat length;
//Copy paramter into temp point
TempPt = *NewPt;
//Adjust point coords and scale down to range of [-1 ... 1]
TempPt.s.X = (TempPt.s.X * this->AdjustWidth) - 1.0f;
TempPt.s.Y = 1.0f - (TempPt.s.Y * this->AdjustHeight);
//Compute the square of the length of the vector to the point from the center
length = (TempPt.s.X * TempPt.s.X) + (TempPt.s.Y * TempPt.s.Y);
//If the point is mapped outside of the sphere... (length > radius squared)
if (length > 1.0f)
{
GLfloat norm;
//Compute a normalizing factor (radius / sqrt(length))
norm = 1.0f / FuncSqrt(length);
//Return the “normalized“ vector a point on the sphere
NewVec->s.X = TempPt.s.X * norm;
NewVec->s.Y = TempPt.s.Y * norm;
NewVec->s.Z = 0.0f;
}
else //Else it‘s on the inside
{
//Return a vector to a point mapped inside the sphere sqrt(radius squared - length)
NewVec->s.X = TempPt.s.X;
NewVec->s.Y = TempPt.s.Y;
NewVec->s.Z = FuncSqrt(1.0f - length);
}
}
//Create/Destroy
ArcBall_t::ArcBall_t(GLfloat NewWidth GLfloat NewHeight)
{
//Clear initial values
this->StVec.s.X =
this->StVec.s.Y =
this->StVec.s.Z =
this->EnVec.s.X =
this->EnVec.s.Y =
this->EnVec.s.Z = 0.0f;
//Set initial bounds
this->setBounds(NewWidth NewHeight);
}
//Mouse down
void ArcBall_t::c
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2015-10-21 14:12 Euler\
目录 0 2015-10-21 14:12 Euler\Debug\
目录 0 2015-10-21 14:07 Euler\ipch\
目录 0 2015-10-21 14:07 Euler\ipch\subwindow-eeaa3bd8\
文件 33357824 2015-10-21 14:07 Euler\ipch\subwindow-eeaa3bd8\subwindow-2a6698ee.ipch
文件 33357824 2015-10-21 14:07 Euler\ipch\subwindow-eeaa3bd8\subwindow-62a39b68.ipch
目录 0 2015-10-21 14:07 Euler\Release\
文件 42496 2011-10-30 18:52 Euler\Release\Euler_v1_3.exe
文件 560128 2011-10-30 18:52 Euler\Release\subwindow.pdb
目录 0 2015-10-21 14:05 Euler\subwindow\
文件 8834048 2011-10-30 18:52 Euler\subwindow.ncb
文件 28856320 2015-10-21 14:12 Euler\subwindow.sdf
文件 894 2015-10-21 14:05 Euler\subwindow.sln
文件 893 2011-10-24 18:52 Euler\subwindow.sln.old
文件 42496 2015-10-21 14:12 Euler\subwindow.suo
文件 38912 2011-10-30 18:52 Euler\subwindow.suo.old
文件 4350 2011-10-27 21:21 Euler\subwindow\arcball.cpp
文件 18372 2015-10-21 14:07 Euler\subwindow\arcball.h
目录 0 2015-10-21 14:12 Euler\subwindow\Debug\
文件 35232 2015-10-21 14:12 Euler\subwindow\Debug\arcball.obj
文件 15470 2011-10-28 23:05 Euler\subwindow\Debug\BuildLog.htm
文件 1758 2015-10-21 14:12 Euler\subwindow\Debug\cl.command.1.tlog
文件 35840 2015-10-21 14:12 Euler\subwindow\Debug\CL.read.1.tlog
文件 972 2015-10-21 14:12 Euler\subwindow\Debug\CL.write.1.tlog
文件 2 2015-10-21 14:12 Euler\subwindow\Debug\li
文件 2 2015-10-21 14:12 Euler\subwindow\Debug\li
文件 2 2015-10-21 14:12 Euler\subwindow\Debug\li
文件 338684 2015-10-21 14:12 Euler\subwindow\Debug\Main.obj
文件 65 2011-10-28 23:05 Euler\subwindow\Debug\mt.dep
文件 538 2015-10-21 14:12 Euler\subwindow\Debug\rc.command.1.tlog
文件 2590 2015-10-21 14:12 Euler\subwindow\Debug\rc.read.1.tlog
............此处省略51个文件信息
- 上一篇:网络编程实用教程
- 下一篇:HNOI模拟 2016.3.31 百步穿杨
评论
共有 条评论