THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 27/10/2012 at 16:17, xxxxxxxx wrote:
Below is a piece of that I used to convert longitude / latitude to sphere coordinates.
However, it is not working and I cannot see what I do wrong.
Input e.g. New York lat=40.714, lon=-74.606 and radius=100
longitude = c4d.utils.Rad(lat)
latitude = c4d.utils.Rad(lon)
x = radius * math.cos(latitude)*math.cos(longitude)
y = radius * math.cos(latitude)*math.sin(longitude)
z = radius * math.sin(latitude)
sphereobj = c4d.BaseObject(c4d.Osphere) # Create new sphere
sphereobj[c4d.PRIM_SPHERE_RAD] = 20 # set sphere label radius
sphereobj.SetRelPos(c4d.Vector(x,y,z)) # Set position of sphere
doc.InsertObject(sphereobj)