本文整理汇总了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;
}
}
示例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);
}
}
示例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))
{}
示例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();
}
}