[R] 3d polar coordinates in rgl function view3d()

Peter Rossi perossichi at gmail.com
Tue Oct 9 01:12:37 CEST 2012

Dear all:

I'm enjoying using rgl and I want to set a specific viewpoint.

I understand that view3d()  will do so by setting the 3d polar
coordinate angles, theta and phi.

In standard polar coordinates, theta is the angle away from the X axis
in the X-Y plane and phi (inclination angle) is the angle between the
Z axis and the radius vector

It appears that when you use view3d()  theta is defined as the angle
away from the x axis in the X-Z plane and phi is the angle between the
Y axis and the radius vector.

When I use view3d(theta=0, phi=15), my image is flipped on the side
with the Y axis pointing upward and the Z axis pointing toward me.
This seems contrary to the standard definition of polar coordinates.

I have read the rgl help files but these do not define theta or phi.
I also looked at documentation on the rgl site to no avail.

I wonder if someone out there could enlighten me as to what I've got
wrong or how to translate properly between rgl definition and standard
polar coordinates.

thanks very much

peter rossi

  Peter E. Rossi
  James Collins Professor of Marketing, Statistics, and Economics
  UCLA | Anderson School
  110 Westwood Plaza, B4.06
  Los Angeles, CA 90095
  Tel: (773) 294-8616   |   Fax: (310) 206-7422
  perossichi at gmail.com |  www.perossi.org
  SSRN: http://papers.ssrn.com/author=22862

More information about the R-help mailing list