Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Maxon Cinema 4D Convert Latitude and Longitude to point in 3D space

  • Convert Latitude and Longitude to point in 3D space

    Posted by Mio Tanaka on June 10, 2013 at 5:09 am

    Hi,

    I’d like to do a pin-dropping animation around a sphere object representing the globe and there’ll be more than 100 pins which are above certain cities and I’d rather not place them manually. Then I found this function to convert latitude and longitude to a point in C4D.

    https://stackoverflow.com/questions/10473852/convert-latitude-and-longitude-to-point-in-3d-space

    def llarToWorld(lat, lon, alt, rad):
    # see: https://www.mathworks.de/help/toolbox/aeroblks/llatoecefposition.html
    f = 0 # flattening
    ls = atan((1 - f)**2 * tan(lat)) # lambda

    x = rad * cos(ls) * cos(lon) + alt * cos(lat) * cos(lon)
    y = rad * cos(ls) * sin(lon) + alt * cos(lat) * sin(lon)
    z = rad * sin(ls) + alt * sin(lat)

    return c4d.Vector(x, y, z)

    But since this is just a function and I don’t know anything about Python and I don’t know how to make it work, I’m at a loss at the moment. Can somebody explain how to apply this function to a dropping pin object?

    Thank you,

    Mio Tanaka replied 12 years, 11 months ago 1 Member · 0 Replies
  • 0 Replies

Sorry, there were no replies found.

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy