Rotating Divided Circles

  • Thread starter Thread starter Tony
  • Start date Start date
T

Tony

Using VSnet2005

I'm looking to create a circle which would have sections containing a
small image within it (Sort of like a wheel of fortune like thing)

After rotating, I would like to take whatever value I have the space
that is in the 12o'clock position and use it for calculations in my
code.

Would anyone have any advice how to do this, or a link to any demo C#
code that does something similiar?

I'm thinking I would need to use GDI+?


Thanks afforhand! :)

Tony!
 
One way (not necessarily the best) would be to take the number of
degrees in a circle (360) and divide by the number 'spaces' on your
wheel to determine the range of each space. For example if you had 20
spaces on the wheel, each space would occupy 18 degrees (360/20). So
the first space would be 0 - 17 degrees, the second 18-35, and so on.

As you spin the wheel, you will rotate it a certain number of degrees
and whatever it ends up on you would calculate which space it is on.
You would have a variable that holds the current orientation of the
wheel. Continuing the example, if the wheel ended up on 97 degrees that
would be in the space with index 5 (97 / 18) ignoring any fraction.

Somehow you would have an array or collection that contains the
information for each 'space' on the wheel so that when you determine
that it is the space with index 5 (in this example), you would look up
that information and act accordingly.

Hope this gives some ideas. There may be other ways to do this as
well.

Chris
 
One way (not necessarily the best) would be to take the number of
degrees in a circle (360) and divide by the number 'spaces' on your
wheel to determine the range of each space. For example if you had 20
spaces on the wheel, each space would occupy 18 degrees (360/20). So
the first space would be 0 - 17 degrees, the second 18-35, and so on.

As you spin the wheel, you will rotate it a certain number of degrees
and whatever it ends up on you would calculate which space it is on.
You would have a variable that holds the current orientation of the
wheel. Continuing the example, if the wheel ended up on 97 degrees that
would be in the space with index 5 (97 / 18) ignoring any fraction.

Somehow you would have an array or collection that contains the
information for each 'space' on the wheel so that when you determine
that it is the space with index 5 (in this example), you would look up
that information and act accordingly.

Hope this gives some ideas. There may be other ways to do this as
well.

Chris
You could also draw the pie shaped areas as regions and check which region was a
point was in.

Otis Mukinfus
http://www.arltex.com
http://www.tomchilders.com
 
Back
Top