PDA

View Full Version : adding graphical items circular



hema
27th July 2011, 17:37
hi,

My app has 26 ballons(Graphical items) with A-Z as ballon text.
i want to display these in circle in Graphical scene.
i used setPos(::sin((i*6.28)/26)*200,::cos((i*6.28)/26)*200)

it is displaying in circular but at the top of screen that too half cut.
how can i display in middle of the GraphicsScene.

thank u in advance
hema

mvuori
27th July 2011, 18:24
How do sine and cosine work? They oscillate from -1 to +1 around an origon, which is 0. If you want your circel of ballons to have another origin, you need to provide an offset to your positios, like this: setPos(::sin((i*6.28)/26)*200 + x_center,::cos((i*6.28)/26)*200 + y_center)