title: Viewing an object while sitting on a sphere
body: <p>In my JOGL program, I have an object at (0,0,0). I am using spherical coordinates to modify angles theta(inclination) and phi(rotation) to view my object at origin, but I am not able to view it properly. Sometimes the object becomes invisible at some angles, and i am not able to view from all angles.</p>
  <p>Here is my code:</p>
  <pre><code>void decTheta() 
  {        
      theta--;
      ex = distance*Math.sin(Math.toRadians(theta))*Math.cos(Math.toRadians(phi));
      ez = distance*Math.sin(Math.toRadians(theta))*Math.sin(Math.toRadians(phi));
      ey = distance*Math.cos(Math.toRadians(theta));
  }
  
  void incTheta()
  {
      theta++;
      ex = distance*Math.sin(Math.toRadians(theta))*Math.cos(Math.toRadians(phi));
      ez = distance*Math.sin(Math.toRadians(theta))*Math.sin(Math.toRadians(phi));
      ey = distance*Math.cos(Math.toRadians(theta));
  }
  
  void incPhi() 
  {
      phi++;    
      ex = distance*Math.sin(Math.toRadians(theta))*Math.cos(Math.toRadians(phi));
      ez = distance*Math.sin(Math.toRadians(theta))*Math.sin(Math.toRadians(phi));
      ey = distance*Math.cos(Math.toRadians(theta));
  }
  
  void decPhi() 
  {
      phi--;
      ex = distance*Math.sin(Math.toRadians(theta))*Math.cos(Math.toRadians(phi));
      ez = distance*Math.sin(Math.toRadians(theta))*Math.sin(Math.toRadians(phi));
      ey = distance*Math.cos(Math.toRadians(theta));
  }
  </code></pre>
  <p>What am I doing wrong?</p>