当前位置: 首页>>代码示例>>C++>>正文


C++ Arm::set_segments方法代码示例

本文整理汇总了C++中Arm::set_segments方法的典型用法代码示例。如果您正苦于以下问题:C++ Arm::set_segments方法的具体用法?C++ Arm::set_segments怎么用?C++ Arm::set_segments使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Arm的用法示例。


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

示例1: main

int main(int argc, char* argv[]) {
	std::cout.rdbuf(0);

	vector<Segment*> segs;
	Segment *new_seg = new Segment(1, BALLJOINT);
	segs.push_back(new_seg);
	new_seg = new Segment(1, BALLJOINT);
	segs.push_back(new_seg);
	new_seg = new Segment(1, BALLJOINT);
	segs.push_back(new_seg);
	new_seg = new Segment(3.5, BALLJOINT);
	segs.push_back(new_seg);
	new_seg = new Segment(2.5, BALLJOINT);
	segs.push_back(new_seg);
	new_seg = new Segment(1, BALLJOINT);
	segs.push_back(new_seg);
	/*vector<Segment*> segs2;
	Segment *new_seg2 = new Segment(1, BALLJOINT);
	segs2.push_back(new_seg2);
	new_seg2 = new Segment(1, BALLJOINT);
	segs2.push_back(new_seg2);
	new_seg2 = new Segment(1, BALLJOINT);
	segs2.push_back(new_seg2);
	new_seg2 = new Segment(3.5, BALLJOINT);
	segs2.push_back(new_seg2);
	new_seg2 = new Segment(2.5, BALLJOINT);
	segs2.push_back(new_seg2);
	new_seg2 = new Segment(1, BALLJOINT);
	segs2.push_back(new_seg2);
	*/
	mainArm.set_segments(segs);
//	secArm.set_segments(segs2);

	//This initializes glut
	glutInit(&argc, argv);

	//This tells glut to use a double-buffered window with red, green, and blue channels
	glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);

	glutInitWindowSize(500, 500);
	glutInitWindowPosition(0, 0);
	glutCreateWindow("Inverse-Kinematics");

	glutDisplayFunc(display);				// function to run when its time to draw something
	glutReshapeFunc(reshape);				// function to run when the window gets resized

											// set handleInput() function to take keyboard events
	glutKeyboardFunc(handleInput);
	glutSpecialFunc(handleSpecialKeypress);
	glutSpecialUpFunc(handleSpecialKeyReleased);

	// shading stuff?
	glEnable(GL_NORMALIZE);
	glEnable(GL_LIGHTING);
	glEnable(GL_DEPTH_TEST);

	// random light behind your eyes
	GLfloat diffuse0[] = { 1.5, 1.5, 1.5, 1.0 };
	GLfloat ambient0[] = { 1.0, 1.0, 1.0, 1.0 };
	GLfloat specular0[] = { 1.0, 1.0, 1.0, 1.0 };
	GLfloat light0_pos[] = { -5.0, 0.0, 3.0, 1.0 };

	glEnable(GL_LIGHT0);
	glLightfv(GL_LIGHT0, GL_POSITION, light0_pos);
	glLightfv(GL_LIGHT0, GL_AMBIENT, ambient0);
	glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuse0);
	glLightfv(GL_LIGHT0, GL_SPECULAR, specular0);

	//update();
	Neuron my_neuron(0.4, 0.3);
	
	for (int i = 0; i < 30; i++) {
		my_neuron.feedForward(1.0);
		my_neuron.propBacward(7.0);
		update2(my_neuron.feedForward(1.0));	
	}
	
	glutMainLoop();

	return 0;
}
开发者ID:wdchoi,项目名称:IKProject,代码行数:81,代码来源:IkPro.cpp


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