• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ YsAtt3类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中YsAtt3的典型用法代码示例。如果您正苦于以下问题:C++ YsAtt3类的具体用法?C++ YsAtt3怎么用?C++ YsAtt3使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了YsAtt3类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1:

YSRESULT YsCollisionOfPolygon::PrecomputeProjectionOfPolygon2(void)
{
	if(np2>0 && p2!=NULL)
	{
		if(pln2.GetNormal()!=YsOrigin())
		{
			YsAtt3 att;
			YsVec3 prj;
			YsBoundingBoxMaker2 makeBbx;
			int i;

			att.SetForwardVector(pln2.GetNormal());
			att.GetMatrix4x4(p2PrjMat);
			p2PrjMat.Invert();
			p2PrjMat.Translate(-pln2.GetOrigin());

			p2Prj.Set(np2,NULL);
			makeBbx.Begin();
			for(i=0; i<np2; i++)
			{
				prj=p2PrjMat*p2[i];
				p2Prj[i].GetXY(prj);
				makeBbx.Add(p2Prj[i]);
			}
			makeBbx.Get(p2PrjMin,p2PrjMax);
			return YSOK;
		}
		else
		{
			YsErrOut("YsCollisionOfPolygon::PrecomputeProjectionOfPolygon2()\n");
			YsErrOut("  Normal of polygon2 is not set.\n");
			return YSERR;
		}
	}
	else
	{
		YsErrOut("YsCollisionOfPolygon::PrecomputeProjectionOfPolygon2()\n");
		YsErrOut("  This function must be called after SetPolygon2()\n");
		return YSERR;
	}
}
开发者ID:Jenny19880324,项目名称:MCG03,代码行数:41,代码来源:yswizard.cpp


示例2: glColor3d


//.........这里部分代码省略.........
			}
		}

		glLineWidth(1);
	}
	else if(type==IFTYPE_SLIDER)
	{
	}
	else if(type==IFTYPE_ROTATION)
	{
		if(dragging==YSTRUE)
		{
			glColor3d(1.0,0.0,5.0);
		}
		else
		{
			glColor3d(0.0,1.0,0.0);
		}


		glLineWidth(3);
		glBegin(GL_LINES);
		glVertex3dv((rot_center+rot_axis*infiniteLongLine).GetValue());
		glVertex3dv((rot_center-rot_axis*infiniteLongLine).GetValue());
		glEnd();
		glLineWidth(1);


		YsVec3 iVec=rot_iVec;
		YsVec3 jVec=rot_jVec;
		YsVec3 kVec=rot_kVec;

		YsMatrix4x4 mat,axisMat;
		YsAtt3 att;
		att.SetForwardVector(rot_axis);
		att.GetMatrix4x4(axisMat);
		mat.Initialize();
		mat.Rotate(rot_axis.x(),rot_axis.y(),rot_axis.z(),rot_angle);
		mat=mat*axisMat;
		mat.Scale(1.0,1.0,rot_mirror);
		mat.Scale(rot_ref_size,rot_ref_size,rot_ref_size);
		axisMat.Invert();
		mat=mat*axisMat;

		iVec=mat*iVec;
		jVec=mat*jVec;
		kVec=mat*kVec;

		glBegin(GL_LINES);
		for(int i=0; i<360; i+=30)
		{
			YsVec3 p[2];
			double a;
			a=YsPi*2.0*double(i)/360.0;
			p[0]=rot_center+iVec*cos(a)+jVec*1.0+kVec*sin(a);
			p[1]=rot_center+iVec*cos(a)-jVec*1.0+kVec*sin(a);

			glVertex3dv(p[0].GetValue());
			glVertex3dv(p[1].GetValue());
		}
		glEnd();

		glBegin(GL_LINE_LOOP);
		for(int i=0; i<360; i+=10)
		{
			double a;
开发者ID:ninkamat,项目名称:CMU-24-681-CAD-MIProject,代码行数:67,代码来源:fsgui3dgl1.x.cpp


示例3: Motion

void Motion(int x,int y)
{
	if(button==GLUT_DOWN)
	{
		double dx,dy;
		YsVec3 vec;

		dx=double(x-lastX);
		dy=double(lastY-y);
		switch(mouseMode)
		{
		case 0:
			eyeAtt.NoseUp(dy/300.0);
			eyeAtt.YawLeft(-dx/300.0);
			break;
		case 1:
			vec.Set(-dx/30.0,-dy/30.0,0.0);
			vec=eyeAtt.GetMatrix()*vec;
			eyeLookAt=eyeLookAt+vec;
			break;
		}
		glutPostRedisplay();
	}
	lastX=x;
	lastY=y;
}
开发者ID:Jenny19880324,项目名称:MCG03,代码行数:26,代码来源:sample06.cpp


示例4: Display

void YsClassSample::Display(void)
{
	BIPOSATT biEyePos;
	BIPOINT cursor;

	eyePos.Set(0.0,0.0,-eyeDistance);
	eyePos=eyeAtt.GetMatrix()*eyePos;
	eyePos=eyeLookAt+eyePos;

	BiSetPoint(&biEyePos.p,eyePos.x(),eyePos.y(),eyePos.z());
	BiSetAngleDeg(&biEyePos.a,
	              YsRadToDeg(eyeAtt.h()),
	              YsRadToDeg(eyeAtt.p()),
	              YsRadToDeg(eyeAtt.b()));

	BiClearScreen();
	BiStartBuffer(&biEyePos);

	BiSetPoint(&cursor,
	           pointOfInterest.x(),
	           pointOfInterest.y(),
	           pointOfInterest.z());
	BiInsMarker(&cursor,&BiWhite,BIMK_CROSS);
	DrawSlashedPolygon();
	DrawPolygon(4,q,blu,YSFALSE);
	DrawPolygon(4,r,blu,YSFALSE);
	DrawAxis(5.0);

	BiFlushBuffer();
	BiSwapBuffers();
}
开发者ID:Jenny19880324,项目名称:MCG03,代码行数:31,代码来源:sample04.cpp


示例5: Motion

void YsClassSample::Motion(int x,int y)
{
	double dx,dy;
	YsVec3 vec;

	dx=double(x-lastX);
	dy=double(lastY-y);
	switch(mouseMode)
	{
	case 0:
		eyeAtt.NoseUp(dy/300.0);
		eyeAtt.YawLeft(-dx/300.0);
		break;
	case 1:
		vec.Set(-dx/30.0,-dy/30.0,0.0);
		vec=eyeAtt.GetMatrix()*vec;
		eyeLookAt=eyeLookAt+vec;
		break;
	case 2:
		RotatePolygon(p,dy/300.0,-dx/300.0);
		break;
	case 3:
		RotatePolygon(q,dy/300.0,-dx/300.0);
		break;
	case 4:
		RotatePolygon(r,dy/300.0,-dx/300.0);
		break;
	}
	lastX=x;
	lastY=y;
}
开发者ID:Jenny19880324,项目名称:MCG03,代码行数:31,代码来源:sample04.cpp


示例6: Display

void Display(void)
{
	double matBuf[4*4];
	YsVec3 eyePos;
	YsMatrix4x4 eyeTfm;

	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

	eyePos.Set(0.0,0.0,eyeDistance);
	eyePos=eyeAtt.GetMatrix()*eyePos;

	eyeTfm.Initialize();
	eyeTfm.Translate(eyePos);
	eyeTfm.Rotate(eyeAtt);
	eyeTfm.Invert();
	eyeTfm.Translate(-eyeLookAt);

	eyeTfm.GetArray(matBuf);

	glMatrixMode(GL_MODELVIEW);
	glLoadIdentity();
	glMultMatrixd(matBuf);
	DrawShell(sh1,blu,drawInPolygon);
	DrawShell(sh2,grn,drawInPolygon);
	DrawAxis(5.0);
	glFlush();
	glutSwapBuffers();
}
开发者ID:Jenny19880324,项目名称:MCG03,代码行数:28,代码来源:sample05.cpp


示例7: Display

void Display(void)
{
	double matBuf[4*4];
	YsVec3 eyePos;
	YsMatrix4x4 eyeTfm;

	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

	eyePos.Set(0.0,0.0,eyeDistance);
	eyePos=eyeAtt.GetMatrix()*eyePos;

	eyeTfm.Initialize();
	eyeTfm.Translate(eyePos);
	eyeTfm.Rotate(eyeAtt);
	eyeTfm.Invert();
	eyeTfm.Translate(-eyeLookAt);

	eyeTfm.GetArray(matBuf);

	glMatrixMode(GL_MODELVIEW);
	glLoadIdentity();
	glMultMatrixd(matBuf);
	DrawSeparatablePair(nVtx,vtx);

	glFlush();
	glutSwapBuffers();
}
开发者ID:Jenny19880324,项目名称:MCG03,代码行数:27,代码来源:sample07.cpp


示例8: MoveShell

void MoveShell(YsShell &sh,YsVec3 &mov)
{
	YsMatrix4x4 mat,trn,viw,iViw;

	sh.GetMatrix(mat);

	viw=eyeAtt.GetMatrix();
	iViw=viw;
	iViw.Invert();

	trn.Initialize();
	trn.Translate(mov);

	mat=viw*trn*iViw*mat;

	sh.SetMatrix(mat);
}
开发者ID:Jenny19880324,项目名称:MCG03,代码行数:17,代码来源:sample05.cpp


示例9: RotateShell

void RotateShell(YsShell &sh,double pitch,double yaw)
{
	YsMatrix4x4 mat,rot,viw,iViw;

	sh.GetMatrix(mat);

	viw=eyeAtt.GetMatrix();
	iViw=viw;
	iViw.Invert();

	rot.Initialize();
	rot.RotateZY(pitch);
	rot.RotateXZ(yaw);

	mat=viw*rot*iViw*mat;

	sh.SetMatrix(mat);
}
开发者ID:Jenny19880324,项目名称:MCG03,代码行数:18,代码来源:sample05.cpp


示例10: Display

void Display(void)
{
	double matBuf[4*4];
	YsVec3 eyePos;
	YsMatrix4x4 eyeTfm;
	YsVec3 p;

	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

	eyePos.Set(0.0,0.0,eyeDistance);
	eyePos=eyeAtt.GetMatrix()*eyePos;

	eyeTfm.Initialize();
	eyeTfm.Translate(eyePos);
	eyeTfm.Rotate(eyeAtt);
	eyeTfm.Invert();
	eyeTfm.Translate(-eyeLookAt);

	eyeTfm.GetArray(matBuf);

	glMatrixMode(GL_MODELVIEW);
	glLoadIdentity();
	glMultMatrixd(matBuf);
	DrawAxis(5.0);

	glDisable(GL_LIGHTING);
	glColor3d(1.0,1.0,1.0);
	glBegin(GL_LINES);
	glVertex3d(0.0,0.0,0.0);
	glVertex3d(axisOfOrbit.x()*5.0,axisOfOrbit.y()*5.0,axisOfOrbit.z()*5.0);
	glEnd();

	rot.RotatePositive(p,orbiter);
	glPushMatrix();
	glTranslatef(p.x()*5.0,p.y()*5.0,p.z()*5.0);
	DrawCursor();
	glPopMatrix();

	glFlush();
	glutSwapBuffers();
}
开发者ID:Jenny19880324,项目名称:MCG03,代码行数:41,代码来源:sample06.cpp


示例11: MainLoop

void YsClassSample::MainLoop(void)
{
	int lb,mb,rb;
	long mx,my;

	eyeDistance=10.0;
	eyeLookAt.Set(0.0,0.0,0.0);
	eyeAtt.Set(0.0,0.0,0.0);

	pointOfInterest.Set(0.0,0.0,-1.0);
	PrepareSquare(p);
	PrepareSquare(q);
	RotatePolygon(q,YsDegToRad(90.0),0.0);
	PrepareSquare(r);
	RotatePolygon(r,0.0,YsDegToRad(90.0));

	BiMouse(&lb,&mb,&rb,&mx,&my);

	mouseMode=0;
	while((key=BiInkey())!=BIKEY_ESC)
	{
		BIPROJ prj;

		BiUpdateDevice();
		BiGetStdProjection(&prj);
		BiSetProjection(&prj);

		Key(key);
		Display();

		lastX=mx;
		lastY=my;
		BiMouse(&lb,&mb,&rb,&mx,&my);
		if(lb==BI_ON && (mx!=lastX || my!=lastY))
		{
			Motion(mx,my);
		}
	}

}
开发者ID:Jenny19880324,项目名称:MCG03,代码行数:40,代码来源:sample04.cpp


示例12: main

int main(int argc, char** argv)
{
	InitYsClass();
	PrepareShell(sh1);
	PrepareShell(sh2);

	printf("Keys\n");
	printf("A....Viewing Rotation Mode\n");
	printf("B....Viewing Translation (Scroll) Mode\n");
	printf("C....Rotate Shell 1\n");
	printf("D....Move Shell 1\n");
	printf("E....Rotate Shell 2\n");
	printf("F....Move Shell 2\n");
	printf("G....Polygon/Wireframe\n");
	printf("O....Or(UNION)\n");
	printf("I....And(INTERSECTION)\n");
	printf("S....Minus(DIFFERENCE)\n");
	printf("Z....Zoom\n");
	printf("M....Mooz\n");
	printf("----------\n");

	eyeAtt.Set(0.0,0.0,0.0);
	eyeDistance=10.0;

	glutInit(&argc, argv);
	glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
	glutInitWindowSize(500, 500);
	glutInitWindowPosition(100, 100);
	glutCreateWindow(argv[0]);
	InitOpenGL();
	glutDisplayFunc(Display);
	glutReshapeFunc(Reshape);
	glutKeyboardFunc(Keyboard);
	glutMouseFunc(Mouse);
	glutMotionFunc(Motion);
	glutIdleFunc(Idle);
	glutMainLoop();
	return 0;
}
开发者ID:Jenny19880324,项目名称:MCG03,代码行数:39,代码来源:sample05.cpp


示例13: main

int main(int argc, char** argv)
{
	InitYsClass();
	PrepareSquare(p);
	PrepareSquare(q);
	RotatePolygon(q,YsDegToRad(90.0),0.0);
	PrepareSquare(r);
	RotatePolygon(r,0.0,YsDegToRad(90.0));

	printf("Keys\n");
	printf("A....Viewing Rotation Mode\n");
	printf("B....Viewing Translation (Scroll) Mode\n");
	printf("C....Rotate polygon 1(Target Polygon)\n");
	printf("D....Rotate polygon 2(Slasher)\n");
	printf("E....Rotate polygon 3(Slasher)\n");
	printf("Z....Zoom\n");
	printf("M....Mooz\n");
	printf("----------\n");

	mouseMode=3;

	eyeAtt.Set(0.0,0.0,0.0);
	eyeDistance=10.0;

	glutInit(&argc, argv);
	glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
	glutInitWindowSize(500, 500);
	glutInitWindowPosition(100, 100);
	glutCreateWindow(argv[0]);
	InitOpenGL();
	glutDisplayFunc(Display);
	glutReshapeFunc(Reshape);
	glutKeyboardFunc(Keyboard);
	glutMouseFunc(Mouse);
	glutMotionFunc(Motion);
	glutIdleFunc(Idle);
	glutMainLoop();
	return 0;
}
开发者ID:Jenny19880324,项目名称:MCG03,代码行数:39,代码来源:sample04.cpp


示例14: main

int main(int argc, char** argv)
{
	InitYsClass();

	axisOfOrbit.Set(1.0,1.0,1.0);
	axisOfOrbit.Normalize();

	orbiter=axisOfOrbit.GetArbitraryParpendicularVector();
	orbiter.Normalize();

	rot.Set(axisOfOrbit,0.0);


	printf("Keys\n");
	printf("A....Viewing Rotation Mode\n");
	printf("B....Viewing Translation (Scroll) Mode\n");
	printf("Z....Zoom\n");
	printf("M....Mooz\n");
	printf("----------\n");

	eyeAtt.Set(YsPi/2.0,0.0,0.0);
	eyeDistance=10.0;

	glutInit(&argc, argv);
	glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
	glutInitWindowSize(500, 500);
	glutInitWindowPosition(100, 100);
	glutCreateWindow(argv[0]);
	InitOpenGL();
	glutDisplayFunc(Display);
	glutReshapeFunc(Reshape);
	glutKeyboardFunc(Keyboard);
	glutMouseFunc(Mouse);
	glutMotionFunc(Motion);
	glutIdleFunc(Idle);
	glutMainLoop();
	return 0;
}
开发者ID:Jenny19880324,项目名称:MCG03,代码行数:38,代码来源:sample06.cpp


示例15: main

int main(int argc, char** argv)
{
	int i;

	InitYsClass();

	for(i=0; i<nVtx; i++)
	{
		vtx[i].Set(&v[i*3]);
	}

	printf("Keys\n");
	printf("A....Viewing Rotation Mode\n");
	printf("B....Viewing Translation (Scroll) Mode\n");
	printf("Z....Zoom\n");
	printf("M....Mooz\n");
	printf("----------\n");

	eyeAtt.Set(0.0,0.0,0.0);
	eyeDistance=10.0;

	glutInit(&argc, argv);
	glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
	glutInitWindowSize(500, 500);
	glutInitWindowPosition(100, 100);
	glutCreateWindow(argv[0]);
	InitOpenGL();
	glutDisplayFunc(Display);
	glutReshapeFunc(Reshape);
	glutKeyboardFunc(Keyboard);
	glutMouseFunc(Mouse);
	glutMotionFunc(Motion);
	glutIdleFunc(Idle);
	glutMainLoop();
	return 0;
}
开发者ID:Jenny19880324,项目名称:MCG03,代码行数:36,代码来源:sample07.cpp



注:本文中的YsAtt3类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ YsShellExt类代码示例发布时间:2022-05-31
下一篇:
C++ YsArray类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap