-
Notifications
You must be signed in to change notification settings - Fork 0
/
DSK2XYZ.m
47 lines (31 loc) · 907 Bytes
/
DSK2XYZ.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
function [x_surf,y_surf,z_surf] = DSK2XYZ(filename_shape,lat,lon,c)
s = size(lat);
%% Renormalize
TOL = 1.d-12;
% Open the DSK file for read access.
% We use the DAS-level interface for
% this function.
handle = cspice_dasopr( filename_shape );
% Begin a forward search through the
% kernel, treating the file as a DLA.
% In this example, it's a very short
% search.
[dladsc, found] = cspice_dlabfs( handle );
if ~found
%
% We arrive here only if the kernel
% contains no segments. This is
% unexpected, but we're prepared for it.
%
fprintf( 'No segments found in DSK file %s\n', dsk )
return
end
lat = lat(:);
lon = lon(:);
sph = zeros(2,numel(lat));
sph(1,:) = lon;
sph(2,:) = lat;
[spoints, ~] = cspice_llgrid_pl02( handle, dladsc, sph );
x_surf = reshape(spoints(1,:),s)*c;
y_surf = reshape(spoints(2,:),s)*c;
z_surf = reshape(spoints(3,:),s)*c;