Cacti (home)ForumsRepositoryDocumentation
Cacti: offical forums and support  

 FAQFAQ   SearchSearch   MemberlistMemberlist    RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in    


Circular sector plotting

 
Post new topic   Reply to topic    Cacti Forum Index -> Plugin: (Network Weather Map)
Author Message
feathers1664



Joined: 30 Oct 2007
Posts: 9
Location: United Kingdom

PostPosted: Fri Mar 28, 2008 12:14 pm    Post subject: Circular sector plotting Reply with quote

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: 1989
Location: United Kingdom

PostPosted: Fri Mar 28, 2008 1:13 pm    Post subject: Re: Circular sector plotting Reply with quote

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: 1989
Location: United Kingdom

PostPosted: Tue Aug 26, 2008 1:56 pm    Post subject: Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    Cacti Forum Index -> Plugin: (Network Weather Map) All times are GMT - 5 Hours
Page 1 of 1

 



Powered by phpBB © 2001, 2005 phpBB Group