One more question about this. How can I draw a line between any two given points?
I am doing this world = sphere((0,0,0), size=1, color='blue') cities = [(38.7598, -121.294),(40.3503, -74.6594),(27.959, -82.4821)] t = RDF(pi/180) city_coords = [(cos(t*theta)*cos(t*phi), sin(t*theta)*cos(t*phi), sin(t*phi)) for theta, phi in cities] world + sum([point3d(v, color='red') for v in city_coords]) How can I draw a line between these cities? I am not sure if there is a direct function to do this. One way to do this might be drawing a series of dots between any two cities using geocoordinates too. Thanks On Nov 9, 8:53 pm, acardh <[EMAIL PROTECTED]> wrote: > Thanks Robert, it's exactly what I needed. It was so easy for you, I > guess. > > :o) > > On Nov 9, 12:28 am, Robert Bradshaw <[EMAIL PROTECTED]> > wrote: > > > On Nov 8, 2008, at 7:52 PM, acardh wrote: > > > > Hi, > > > Plotting an sphere is straightforward but I need help in how to draw > > > points on the sphere. The sphere will represent the Earth and the > > > points will be some geo-coordinates . > > > > Thanks!!! > > > This depends on how your points are given. I'm going to assume you > > have latitude/longitude (in degrees), called phi and theta > > respectively. Then one would draw the sphere via > > > sage: world = sphere((0,0,0), radius=1, color='blue') > > > Here I'm making 100 random cities. > > sage: cities = [(ZZ.random_element(-180,180), ZZ.random_element > > (-90,90)) for _ in range(100)] > > > Now I'll convert polar coordinates to regular xyz coordinates. > > sage: t = RDF(pi/180) > > sage: city_coords = [(cos(t*theta)*cos(t*phi), sin(t*theta)*cos > > (t*phi), sin(t*phi)) for theta, phi in cities] > > > Now I'll plot them > > sage: world + sum([point3d(v, color='red') for v in city_coords]) > > > I could have, of course, done something more interesting than "points" > > sage: world + sum([tetrahedron(size=.1, color='yellow').translate(v) > > for v in city_coords]) > > > - Robert --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---