Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Animation of graph drawing  RSS feed

 
Paul W Lee
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone,
I'm going to implement a animation application that can automatically drawing some graphs. The scenario is like the following:
1. draw a graph, for example a tree, which nodes are randomly located,
2. adjust the positions of the nodes by some rules.
I want to show the changing step by step. but after the initial drawing( 1st step), the changings in 2nd step won't be displayed, and there is only the final view.
The psudocode is like:
paint( Graphics g ){
draw_the_graph( Graphics g ):
draw_node(g, a_node )
draw_edge(g, an_edge )
adjust_the_graph():
//do iteration to adjust all the nodes
for all the nodes:
set_new_position
draw_the_node
the_frame.repaint()
//iteration finish
}
Any one can help me?
Thank you in advance.
Regards,
Paul
[ May 01, 2004: Message edited by: Paul W Lee ]
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!