|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r52138 - trunk/boost/graph
From: jewillco_at_[hidden]
Date: 2009-04-02 14:17:38
Author: jewillco
Date: 2009-04-02 14:17:38 EDT (Thu, 02 Apr 2009)
New Revision: 52138
URL: http://svn.boost.org/trac/boost/changeset/52138
Log:
Removed uses of drand48() in Fruchterman-Reingold layout
Text files modified:
trunk/boost/graph/fruchterman_reingold.hpp | 14 +-------------
1 files changed, 1 insertions(+), 13 deletions(-)
Modified: trunk/boost/graph/fruchterman_reingold.hpp
==============================================================================
--- trunk/boost/graph/fruchterman_reingold.hpp (original)
+++ trunk/boost/graph/fruchterman_reingold.hpp 2009-04-02 14:17:38 EDT (Thu, 02 Apr 2009)
@@ -21,8 +21,6 @@
#include <cmath> // for std::sqrt and std::fabs
#include <functional>
-#include <stdlib.h> // for drand48
-
namespace boost {
bool vertex_migration = false;
@@ -224,19 +222,9 @@
typename Topology::point_type& p1, const typename Topology::point_type& p2,
typename Topology::point_type origin, typename Topology::point_difference_type extent)
{
-#ifndef BOOST_NO_STDC_NAMESPACE
- using std::sqrt;
- using std::fabs;
-#endif // BOOST_NO_STDC_NAMESPACE
double too_close = topology.norm(extent) / 10000.;
if (topology.distance(p1, p2) < too_close) {
- double dist_to_move = sqrt(topology.norm(extent)) / 200.;
- for (std::size_t i = 0; i < Topology::point_type::dimensions; ++i) {
- if (p1[i] - origin[i] < origin[i] + extent[i] - p1[i])
- p1[i] += dist_to_move * drand48();
- else
- p1[i] -= dist_to_move * drand48();
- }
+ p1 = topology.move_position_toward(p1, 1./200, topology.random_point());
}
}
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk