;+
; NAME:
;	V4XSC2HEC
; PURPOSE:
;	Convert Solar Cartesian to Heliocentric Ecliptic Cartesian coordinates
;	(normally called by V4XFORM based on the v4xforms structure)
; CALLING SEQUENCE:
;	out = V4XCART2SPH(in,/verbose,index=ix,outdex=ox,ocoord=ocoord)
; INPUTS:
;	in - a V4 structure containing the co-ordinates to 
;	     transform
; RETURNS:
;	The transformed vector (or array)
; KEYWORDS:
;	VERBOSE - Be chatty
;	INDEX   - A 4-array that re-orders the input vector  (IGNORED)
;	OUTDEX  - A 4-array that re-orders the output vector (IGNORED)
;	OCOORD  - The coordinate system name for the output coordinates 
; 
; METHOD:
;	Calculate the B angle then apply a rotation matrix
; AUTHOR:
;	Craig DeForest
; HISTORY: 
;	Initial implementation, 5-April-1999
;-
function V4XSC2HEC,in,verbose=v,index=ix,outdex=ox,ocoords=ocoords

;;;
;;; Check out input keywords for existence...
;;;
if not isvalid(ix) then ix = [0,1,2,3]
if not isvalid(ox) then ox = [0,1,2,3]

ox = ix
iu = ix+5
ou = ox+5

;;;
;;; Find the B angle and position...
pbr = zpb0r(in.(ix(0)))
B = pbr(1,*)/!radeg
if(nlm(b) eq 1) then b=b(0)

i2 = v4canon(in)

out = i2
out.coords="Heliographic Cartesian"
out.(ix(2)) =   i2.(ix(2))*cos(B) + i2.(ix(3))*sin(B)
out.(ix(3)) = - i2.(ix(2))*sin(B) + i2.(ix(3))*cos(B)

return,out
end
