Changeset 180:911c6ba0e3c8 in glemon-0.x
- Timestamp:
- 11/07/06 22:27:28 (18 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/glemon/trunk@3066
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
graph_displayer_canvas.cc
r177 r180 321 321 actual_forces.setYMap(y); 322 322 323 lemon::dim2::Point<double> delta;324 325 323 //count actual force for each nodes 326 324 for (NodeIt i((mytab.mapstorage).graph); i!=INVALID; ++i) … … 331 329 if(i!=j) 332 330 { 333 delta=((mytab.mapstorage).coords[i]-(mytab.mapstorage).coords[j]); 334 335 double length_sqr=delta.normSquare(); 336 double length=sqrt(length_sqr); 337 if(length_sqr<min_dist) 338 { 339 length_sqr=min_dist; 340 } 331 lemon::dim2::Point<double> delta = 332 ((mytab.mapstorage).coords[i]- 333 (mytab.mapstorage).coords[j]); 334 335 const double length_sqr=std::max(delta.normSquare(),min_dist); 341 336 342 337 //normalize vector 343 delta/= length;338 delta/=sqrt(length_sqr); 344 339 345 340 //calculating propulsation strength … … 353 348 for(OutEdgeIt ei((mytab.mapstorage).graph,i);ei!=INVALID;++ei) 354 349 { 355 delta=((mytab.mapstorage).coords[i]-(mytab.mapstorage).coords[mytab.mapstorage.graph.target(ei)]); 356 357 double length_sqr=delta.normSquare(); 358 double length=sqrt(length_sqr); 359 if(length_sqr<min_dist) 360 { 361 length_sqr=min_dist; 362 } 363 364 //normalize vector 365 delta/=length; 366 367 //calculating attraction strength 368 //greater distance means greater strength 369 delta*=attraction*length; 370 371 actual_forces.set(i,actual_forces[i]-delta); 350 lemon::dim2::Point<double> delta = 351 ((mytab.mapstorage).coords[i]- 352 (mytab.mapstorage).coords[mytab.mapstorage. 353 graph.target(ei)]); 354 355 //calculating attraction strength 356 //greater distance means greater strength 357 delta*=attraction; 358 359 actual_forces.set(i,actual_forces[i]-delta); 372 360 } 373 361 for(InEdgeIt ei((mytab.mapstorage).graph,i);ei!=INVALID;++ei) 374 362 { 375 delta=((mytab.mapstorage).coords[i]-(mytab.mapstorage).coords[mytab.mapstorage.graph.source(ei)]); 376 377 double length_sqr=delta.normSquare(); 378 double length=sqrt(length_sqr); 379 if(length_sqr<min_dist) 380 { 381 length_sqr=min_dist; 382 } 383 384 //normalize vector 385 delta/=length; 386 387 //calculating attraction strength 388 //greater distance means greater strength 389 delta*=attraction*length; 390 391 actual_forces.set(i,actual_forces[i]-delta); 363 lemon::dim2::Point<double> delta = 364 ((mytab.mapstorage).coords[i]- 365 (mytab.mapstorage).coords[mytab.mapstorage. 366 graph.source(ei)]); 367 368 //calculating attraction strength 369 //greater distance means greater strength 370 delta*=attraction; 371 372 actual_forces.set(i,actual_forces[i]-delta); 392 373 } 393 374 }
Note: See TracChangeset
for help on using the changeset viewer.