cspice_srfrec

 Abstract I/O Examples Particulars Required Reading Version Index_Entries
```
```

#### Abstract

```
CSPICE_SRFREC converts planetocentric latitude and longitude
of a surface point on a specified body to rectangular
coordinates.

For important details concerning this module's function, please refer to
the CSPICE routine srfrec_c.

```

#### I/O

```
Given:

body       is the scalar NAIF integer code of an extended body
on which a surface point of interest is located.
The body is modeled as a triaxial ellipsoid.

longitude  a double precision scalar or N-vector describing
longitude, the angle measured in radians between
the prime meridian and the meridian containing
'rectan'. The direction of increasing longitude
is from the +X axis towards the +Y axis.

On input, the range of longitude is unrestricted.

latitude   a double precision scalar or N-vector describing
latitude, the angle measured in radians from the
XY plane of the ray from the origin through the point.

the call:

cspice_srfrec, body, longitude, latitude, rectan

returns:

rectan   a double precision 3-vector or 3xN array
containing the rectangular coordinates of the
position or set of positions.

'rectan' returns with the same measure of vectorization (N)
as 'longitude' and 'latitude'.

The units associated with 'rectan' are km.

```

#### Examples

```
;;
;; NAIF ID for our body of interest.
;;
EARTH =  399

;;
;; Load the kernel pool with a PCK file that contains
;; values for the radii of the Earth.
;;
cspice_furnsh, 'standard.tm'

;;
;; Find 'x', the rectangular coordinates of the surface point
;; defined by 'lat' and 'long'.  The NAIF integer code for
;; the Earth is 399. (Reference NAIF_IDS.REQ for the complete
;; set of codes.)
;;
lon =  100.d0
lat =   35.d0

print, "Original latitudinal coordinates: "
print, "                 Longitude (deg): ", lon
print, "                 Latitude  (deg): ", lat

print

;;
;; Convert angles to radians for input to srfrec_c.
;;
cspice_srfrec, EARTH, lon*cspice_rpd(), lat*cspice_rpd(), x

print, "Rectangular coordinates: "
print, "                 X (km): ", x
print, "                 Y (km): ", x
print, "                 Z (km): ", x

print

;;
;;
;; Now try to recover the original latitudinal coordinates
;; from the rectangular coordinates found by cspice_srfrec.
;;
cspice_reclat, x, radius, lon1, lat1

;;
;; Convert angles back to degree for display.
;;
print, "Latitudinal coordinates recovered from "
print, "rectangular coordinates: "
print, "                 Longitude (deg): ", lon1*cspice_dpr()
print, "                 Latitude  (deg): ", lat1*cspice_dpr()

IDL Outputs:

Original latitudinal coordinates:
Longitude (deg):        100.00000
Latitude  (deg):        35.000000

Rectangular coordinates:
X (km):       -906.24943
Y (km):        5139.5959
Z (km):        3654.3008

Latitudinal coordinates recovered from
rectangular coordinates:
Longitude (deg):        100.00000
Latitude  (deg):        35.000000

```

```
None.

```

```
KERNEL.REQ
NAIF_IDS.REQ
ICY.REQ

```

#### Version

```
-Icy Version 1.0.2, 05-FEB-2008, EDW (JPL)

Edited I/O section, replaced comment

"returns with the same order"

with

"returns with the same measure of vectorization"

-Icy Version 1.0.1, 09-DEC-2005, EDW (JPL)

Added tag for Examples section.

-Icy Version 1.0.0, 31-OCT-2005, EDW (JPL)

```

#### Index_Entries

```
convert bodyfixed latitudinal coordinates to rectangular
convert surface latitudinal coordinates to rectangular
surface point latitudinal coordinates to rectangular

```
`Wed Apr  5 17:58:04 2017`