"paul wisehart" <wisehart@runbox.com> wrote
Hi Paul,
You are close. Your lat/lon data isn't in the correct format so cv_coord
isn't returning meaningful results.
The spherical data must be in the form [3,n] so your line:
sph_coord = [pt1,pt2]
should be:
sph_coord = [[pt1],[pt2]]
I have attached a modified version of your program below. Note that my
lat/lons are in degrees and I set the degrees keyword to CV_COORD
accordingly.
You can answer your questions about the orb yourself. Use the getproperty
method of the orb to get the DATA property of the orb's IDLgrPolygon object.
The data will be a [3,n] array of verticies that make up the orb.
my_model = obj_new('idlgrmodel')
my_orb = obj_new('orb', COLOR=[0, 255, 0], RADIUS=0.8, $
DENSITY=2, style=2);,hide=0,/zero)
my_model -> add, my_orb
pt_radius = 0.801
sph_coord = FLTARR(3,361)
sph_coord[0,*] = FINDGEN(361)
sph_coord[2,*] = pt_radius
rect_coord = CV_COORD(FROM_sphere=sph_coord,/to_rect, /DEGREES)
my_poly = obj_new('idlgrpolyline',rect_coord, thick=2.0, $
color=[255,0,0])
my_model -> add, my_poly
xobjview, my_model, /BLOCK
obj_destroy, my_model
end
Enjoy!
-Rick
> Hi,
> Its me again w/the 3D spheres : )
> I'm having trouble understanding the coordinate system
> w/regards to the IDLgrPolyline (or Polygon) methods and 'orb's.
>
> Here's an example:
> ;--------------------------------------------------
> my_image = obj_new('IDLgrImage', earthImage)
> my_orb = obj_new('orb', COLOR=[0, 255, 0], RADIUS=0.8, $
> DENSITY=2, /TEX_COORDS, TEXTURE_MAP=oimage1,style=1,hide=0,/zero)
>
> pt_radius = 1
> pt1 = [0,0,pt_radius]
> pt2 = [15,0,pt_radius]
>
> sph_coord = [pt1,pt2]
> rect_coord = CV_COORD(FROM_sphere=sph_coord,/to_rect)
>
> my_poly = obj_new('idlgrpolyline',rect_coord,$
> thick=10,color=[255,0,0])
>
> my_model -> add, my_poly
> my_model -> add, my_orb
>
> xobjview, my_model
> ;--------------------------------------------------
>
> My 'pt1' and 'pt2' are supposed to be lat/lon coordinates.(spherical)
> I convert them to rectangular coordinates.
>
> I've tried pt_radius values .4 -> 1.4 (or so)
>
> I'm trying to draw a line on the surface of the sphere.
> The lines I am getting are outside the sphere or not there.
> I cannot figure out how the coordinate system works.
> I am assuming that by leaving the radius constant my lines will
> follow the curve of a sphere.
>
> Whats the default coordinate range of an 'orb' object?
> Where's [0,0,0]? At the center of the sphere?
> Is the sphere in a 'frame' where [0,0,0] is a vertex?
>
> I can't find any info on the coordinate systems used in object
> graphics in the manual either. Maybe someone know's where to look?
> (IDL 5.4 by the way)
>
> THANKS!!!!
> I'll try to stop bugging you after this one.
>
> --
> paul wisehart
> wisehart <at> runbox <dot> com
|