Click here to Skip to main content
15,880,427 members
Please Sign up or sign in to vote.
2.33/5 (2 votes)
See more:

Is there a simple way to dynamically place an assortment of small circles evenly spaced along the circumference of a much larger circle whose coordinates and size are known in advance? "Simple" would probably mean something like being able to specify the placement in terms of polar coordinates of the larger circle, rather than having to calculate absolute x and y coordinates.

This would be for a simple WinForm project. The task is to display a graph which provides an approximate visual representation of nodes on a computer network. The nodes of the graph would be circles, or something else suitable. Some of them will be connected with simple straight lines. In addition, some of the nodes will be "marked" in some fashion: highlighted, or filled in, or displayed with thicker edges, in order to signify that they have a certain status which distinguishes them from the other, unmarked, nodes. Ordinary radio button controls might suffice, if they could be displayed larger than their usual fairly small size. The purpose of the larger circle is simply to provide an approximate "template" for where the smaller nodes should be placed. The idea is to avoid having any of the connecting lines passing through the nodes themselves (or having to curve the lines around nodes), as this would lead to clutter and confusion. If the nodes are arranged in an approximate circle, this can be avoided. Of course, the connecting graph edges may cross each other. In other words, the graph will provide an accurate topographical, though not an accurate geometrical, representation of the computer network.

To calculate where to lay the smaller nodes/circles using Cartesian coordinates seems to me to involve a lot of trigonometric conversion of data from polar coordinates to standard [x,y] format. I would prefer to avoid this, if possible. So I'm wondering whether it can be done directly with polar coordinates.

Unfortunately, I am not familiar with WPF; several of the books that I have started to read about it have made a point of emphasizing its exceptionally steep learning curve.
Posted
Updated 14-Aug-13 6:39am
v7
Comments
Sergey Alexandrovich Kryukov 13-Aug-13 23:54pm    
Yes, it's extremely simple. How can it even be a problem? Just the simple elementary algebra. Why do you thing to ask about a "way"? After all, http://whathaveyoutried.com?
—SA
BillWoodruff 14-Aug-13 10:16am    
WinForms, WPF ? What exactly do you mean by 'Shape here: are you talking about using predefined objects, like a UserControl for example, where you have defined the control's shape, via setting its region property, to be a 'circle ?

Or are you talking about using the Paint event to draw both your original circle, and the smaller circles.

Depending on what the purpose of the circles is: ui decoration; objects you interact with; objects that contain other elements, etc.; very different strategies could be used.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900