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


C++ GraphNode::getPos方法代码示例

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


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

示例1: drawnodes

void Graph :: drawnodes(bool treedee, double sz){
	if (treedee) {
		for (int n=0; n< adjlist.size(); n++) {
			
			GraphNode * gn = adjlist.at(n);
			
			vec3d point = gn->getPos();
				
			glPushMatrix();
			glTranslatef(point.x, point.y, point.z);
			glScalef(sz, sz, sz);
			drawsphere (10, 10);
			glPopMatrix();
			
		}
	}
	else 
	{
		
		glPointSize(sz);
		glBegin(GL_POINTS);
		for (int n=0; n< adjlist.size(); n++) 
		{
			GraphNode * gn = adjlist.at(n);
			vec3d point = gn->getPos();
			glVertex3d(point.x, point.y, point.z);
			
		}
		glEnd();
		
		pointsz = sz;
		
	}

}
开发者ID:charlieroberts,项目名称:topicnet,代码行数:35,代码来源:graph.cpp

示例2: normalizeinitpos

void Graph :: normalizeinitpos(){
	//we want to normalize graph node positions between 0.0 and 1.0
	
	double minx=0.0;
	double maxx = 1.0;
	double miny=0.0;
	double maxy = 1.0;

	for (int a=0; a<adjlist.size(); a++) {
		GraphNode * nd = adjlist.at(a);
		vec3d place = nd->getPos();
		
		minx = min(place.x, minx); 
		maxx = max(place.x, maxx); 
		
		miny = min(place.y, miny); 
		maxy = max(place.y, maxy); 
		
	}
	
	//printf("min max %f, %f, %f, %f \n", minx, maxx, miny, maxy);
	
	double yrange = maxy - miny;
	double xrange = maxx - minx;
	
	for (int a=0; a<adjlist.size(); a++) {
		GraphNode * nd = adjlist.at(a);
		vec3d place = nd->getPos();
		place.x = (place.x - minx) / xrange;
		place.y = (place.y - miny) / yrange;
		
		nd -> setPos(place);
		//printf("place of node %f, %f \n", place.x, place.y);
	}
}
开发者ID:charlieroberts,项目名称:topicnet,代码行数:35,代码来源:graph.cpp

示例3: QuadraticBezier

Bond::Bond(GraphNode& origin,
           GraphNode& partner,
           float strength,
           sf::RenderWindow& w):
    m_strength(strength),
    m_control(new sf::Vector2f(w.getSize().x/2, w.getSize().y/2)),
    m_origin(&origin),
    m_partner(&partner),
    m_graphic(new QuadraticBezier(origin.getPos(), *m_control, partner.getPos(), w))
{}
开发者ID:dtbinh,项目名称:dgl,代码行数:10,代码来源:Bond.cpp

示例4: drawneighbornodes

void Graph :: drawneighbornodes(int ndid, double sz){
	//assume threedee
	vector<GraphNode *> fn = firstNghbrs(ndid);
	
	for (int n=0; n<fn.size(); n++) {
		GraphNode * gn = fn.at(n);
		vec3d point = gn->getPos();
		
		glPushMatrix();
		glTranslatef(point.x, point.y, point.z);
		glScalef(sz, sz, sz);
		drawsphere (10, 10);
		glPopMatrix();
		
	}
	
}
开发者ID:charlieroberts,项目名称:topicnet,代码行数:17,代码来源:graph.cpp


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