jim.blackwell@gsfc.nasa.gov (Jim) wrote in message news:<95167173.0211061237.389f387a@posting.google.com>...
> Hi all,
>
> After playing with several pieces of code I've found in the archives,
> and not having any luck, I figured I'd ask someone here.
>
> I have X, Y, Z points in space with a,b,c vector component values.
> I'd like to plot these in 3-D space. The data points are in the form
> of a rectangular regularly spaced grid.
>
> Any help would be appreciated
>
> Jim Blackwell
This plots an arrow in a 3d plot, at any Z value, however the arrow is
'parallel' to the XY plane...
pro arrow_3d,xcen,ycen,z,a,arrowsize,thick=thick,color=color
; plots an arrow on a 3d plot
; arrowhead is in the horizontal, xy plane
;
; INPUT PARAMETERS:
; xcen, ycen = starting point of arrow in data coordinates
; z = height of arrow above xy plane in data coordinates
; a = angle, degrees c/clockwise from +X direction, in xy plane
;
; OPTIONAL INPUT PARAMETERS:
; thick = usual IDL meaning, default = 2.0
; color = usual IDL meaning, default = !P.COLOR
;
; MODIFICATION HISTORY:
; merged from one_arrow.pro and one_ray.pro, 15 Aug 2002
dtr=!pi/180.
if N_params() LT 5 then begin
print,'Err: arrow_3d,xcen,ycen,z,angle,arrowsize,[,thick=,color=]'
return
endif
if not keyword_set(thick) then thick = 2.0
if not keyword_set(color) then color = !P.COLOR
; forward half of arrow stalk
plots,[xcen,xcen+arrowsize*cos(a*dtr)/2.],$
[ycen,ycen+arrowsize*sin(a*dtr)/2.],$
[z,z], color=color, thick=thick, /t3d
; backward half of arrow stalk
plots,[xcen,xcen-arrowsize*cos(a*dtr)/2.],$
[ycen,ycen-arrowsize*sin(a*dtr)/2.],$
[z,z], color=color, thick=thick, /t3d
; move to arrow head
xcen=xcen+arrowsize*cos(a*dtr)/2.
ycen=ycen+arrowsize*sin(a*dtr)/2.
; plot arrow head
; it's 1/3 the length of stalk, at angle 35 degrees -
plots,[xcen,xcen+arrowsize*cos((180.+a+35.)*dtr)/3.],$
[ycen,ycen+arrowsize*sin((180.+a+35.)*dtr)/3.],$
[z,z], color=color, thick=thick, /t3d
plots,[xcen,xcen+arrowsize*cos((180.+a-35.)*dtr)/3.],$
[ycen,ycen+arrowsize*sin((180.+a-35.)*dtr)/3.],$
[z,z], color=color, thick=thick, /t3d
return
end
|