title: Spherical Coordinate Mapping creating double epsilons
body: <p>Here is an image: <a href="https://i.imgur.com/MRvz24u.gif" rel="nofollow noreferrer">http://i.imgur.com/MRvz24u.gif</a></p>
  
  <p>So I can tell what the problem is, that my epsilon (or whatever that symbol is) used for spherical coordinates are repeating. So the way I calculate the points is:</p>
  
  <pre><code>double theta = acos(p.getY()/p.magnitude());
  theta = theta/3.1415926;
  
  double epsilon = atan(p.getZ()/p.getX());
  epsilon = epsilon + 3.1415926/2;
  epsilon = epsilon /3.1415926;
  </code></pre>
  
  <p>I'm pretty sure the rest isn't the problem but I will put it here just in case</p>
  
  <pre><code>    int w = texture -&gt;columns();
      int h = texture -&gt;rows();
  
      double x = w * epsilon ; x = (int) x;
      double y = h * theta; y = (int) y;
  
      int row = y;
      int column = x;
  
      Magick::PixelPacket *pixels = texture-&gt;getPixels(0, 0, w, h);
      Magick::Color color = pixels[w * row + column];
  
      double range = pow(2, texture -&gt; modulusDepth());
  
      double r = color.redQuantum()/range ;
      double g = color.greenQuantum()/range ;
      double b = color.blueQuantum()/range ;
  
      return Color(r, g, b, 0);
  </code></pre>
  
  <p>I am not sure why I would be getting repeating values because my range should originally be -pi/2 &lt; epsilon &lt; pi/2 and I just shift it then scale it. </p>