Skip to content

Commit

Permalink
Updates to randomizePositions() and moveNodes()
Browse files Browse the repository at this point in the history
  - Now, if the radius is negative we use the last value of maxDistance.
  - Also, we must be sure to shift the lastCenter when the positions of
    all nodes are changed.
  • Loading branch information
chebee7i committed Apr 26, 2012
1 parent c5b7bec commit c7679e6
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/graph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,11 @@ const int Graph::getVersion() const

void Graph::randomizePositions(Vrui::Scalar radius)
{
if (radius < 0)
{
radius = lastMaxDistance / 2;
}

mutex.lock();

Vrui::Scalar x,y,z;
Expand Down Expand Up @@ -529,6 +534,7 @@ void Graph::moveNodes(const Vrui::Vector &offset)
{
nodeMap[node].position += offset;
}
lastCenter += offset;

update();
}
Expand Down

0 comments on commit c7679e6

Please sign in to comment.