|
|
| Author |
Message |
feathers1664
Joined: 30 Oct 2007 Posts: 9 Location: United Kingdom
|
Posted: Fri Mar 28, 2008 12:14 pm Post subject: Circular sector plotting |
|
|
I want to graph multiple nodes in a circular fashion to a central point. I would ideally like them to be equally placed.
Does anyone know of a way of calculating the circumference points if you specify the sector count?
Ie. A circle with just 4 sectors would have lines at 0,90,180 and 270 degrees. How can work out the x,y position of these plots on a circumference given the circle radius?
I've seen an example map by Tybio but I think he uses a script to generate his.
Many thanks! |
|
| Back to top |
|
 |
Howie Cacti Guru User
Joined: 16 Sep 2004 Posts: 2167 Location: United Kingdom
|
Posted: Fri Mar 28, 2008 1:13 pm Post subject: Re: Circular sector plotting |
|
|
| feathers1664 wrote: | I want to graph multiple nodes in a circular fashion to a central point. I would ideally like them to be equally placed.
Does anyone know of a way of calculating the circumference points if you specify the sector count?
Ie. A circle with just 4 sectors would have lines at 0,90,180 and 270 degrees. How can work out the x,y position of these plots on a circumference given the circle radius?
I've seen an example map by Tybio but I think he uses a script to generate his.
Many thanks! |
| Code: |
angle= (360/number-of-things) * number-of-this-thing
X = center_x + distance*cos(angle)
Y = center_y - distance*sin(angle)
|
I think I remembered my high-school trig OK there... |
|
| Back to top |
|
 |
Howie Cacti Guru User
Joined: 16 Sep 2004 Posts: 2167 Location: United Kingdom
|
Posted: Tue Aug 26, 2008 1:56 pm Post subject: |
|
|
I just added this as a new feature in 0.96 - you can position a node relative to another by specifying an angle and radius, and also offset the end of a link the same way. This allows you to generate those fan-like maps a lot easier - you still need to work out the angle to distribute them evenly though.
like this (c1 is the centre node, 210 degrees and 90 pixels out is rrr2, the link goes from there to 20 pixels away from c1, also 210 degrees around):
| Code: |
NODE c1
POSITION 100 100
LABEL c1
NODE rrr2
POSITION c1 210r90
LINK rrc2
NODES rrr2 c1:210r20
|
I also added another variation of the compass-points offset that includes a percentage. I keep finding I want to do 90% NW, so that the link-ends are hidden under the node, when I use large node icons.
| Code: |
LINK aaa1
NODES centre:NW90 c3
|
|
|
| Back to top |
|
 |
|