0
$\begingroup$

I am not an expert in mathematics, I am only a young programmer. I am trying to construct a spherical tag cloud and I've found this formula:

for i,t in enumerate(tags)     phi = acos((2* (i+1) -1) / tag_num -1)     theta = sqrt(tag_num * pi) * phi      x = radius * cos(theta) * sin(phi)     y = radius * sin(theta) * sin(phi)     z = radius * cos(phi)      t.setPosition(x,y,z) 

and it works fine. but I thought, for a spherical disposition, have to do 2 nested for: one for latitude and one for longitude. What kind of formula do I use in these codes? Can you explain me what this acos and sqrt do?

  • 1
    I can't quite see where the `i` and `tag_num` came from, and an angle with a $\sqrt \pi$ factor sounds fishy to me. In any event the effort in `z` looks wasted, since you have an arccosine and then a cosine... where precisely did you find these bits?2011-09-30
  • 2
    You may find the blog post [How I made wine glasses from sunflowers](http://blog.wolfram.com/2011/07/28/how-i-made-wine-glasses-from-sunflowers/) by Cris Carlson very relevant.2011-09-30
  • 0
    @J.M. tag_num is the total number of tag, and i is a paramater that goes from 0 to num_tag-12011-10-01
  • 0
    I'm going to repeat J.M.'s last question and ask again, where exactly did you find this formula?2011-10-01
  • 0
    is it so important? i found it here: http://wonderfl.net/c/n2ly and the formula is at line 722011-10-03
  • 0
    Why do you think it isn't important to cite your sources?2011-10-07
  • 0
    does that source help you in finding an answer?2011-10-07

1 Answers 1