cspice_dskmi2 |
|||

## AbstractCSPICE_DSKMI2 makes a spatial index for type 2 DSK segment. For important details concerning this module's function, please refer to the CSPICE routine dskmi2_c. ## I/OGiven: vrtces is an array of coordinates of the vertices. The Ith vertex occupies elements [0:2,I-1] of this array. plates is an array representing the triangular plates of a shape model. The elements of `plates' are vertex indices; vertex indices, as well as plate indices, are 1-based in all languages supported by SPICE. The vertex indices of the Ith plate occupy elements [0:2,I-1] of this array. finscl is the fine voxel scale. This scale determines the edge length of the cubical voxels comprising the fine voxel grid: the edge length `voxsiz' is approximately finscl * {average plate extent} where the extents of a plate are the respective differences between the maximum and minimum coordinate values of the plate's vertices. The relationship between `voxsiz' and the average plate extent is approximate because the `voxsiz' is adjusted so that each dimension of the fine voxel grid is an integer multiple of the coarse voxel scale. See the Particulars section below for further information on voxel scales. corscl is the coarse voxel scale. This integer scale is the ratio of the edge length of coarse voxels to that of fine voxels. The coarse scale must be large enough so that the total number of coarse voxels does not exceed SPICE_DSK02_MAXCGR (see DSKIcy02.pro). worksz is the second dimension of the workspace array `work'. `worksz' must be at least as large as the greater of - the number of fine voxel-plate associations This number is equal to np * {average number of fine voxels intersected by each plate} - the number of vertex-plate associations, if the vertex-plate mapping is constructed. This number is equal to nv + ( 3 * np ) voxpsz is the size of the fine voxel-plate pointer array. This array maps fine voxels to lists of plates that intersect those voxels. `voxpsz' must be at least as large as 3 corscl * {number of non-empty coarse voxels} voxlsz is the size of the fine voxel-plate list array. This array contains, for each non-empty fine voxel, the count of plates that intersect that voxel and the IDs of those plates. `voxlsz' must be at least as large as `np' * {average number of fine voxels intersected by each plate} + {number of non-empty fine voxels} makvtl is a logical flag that, when set to SPICETRUE, indicates that a vertex-plate association list is to be constructed. The amount of workspace that is needed may depend on whether a vertex-plate association list is constructed. When this list is constructed, the size of the integer component of the spatial index is increased by the size of the list and the size of a vertex-plate pointer array; the total of these sizes is ( 2 * nv ) + ( 3 * np ) spxisz is the declared size of the output array SPAIXI. This size must be at least as large as the sum of - the fixed-size part of the integer component of the index, which includes the coarse voxel grid; this value is SPICE_DSK02_IDXFIX - the size `voxpsz' of the voxel-plate pointer array - the size `voxlsz' of the voxel-plate association list plus, if the vertex-plate association list is constructed, - the size `nv' of the vertex-plate pointer array - the size of the vertex-plate association list; this size is nv + ( 3 * np ) the call: ## ExamplesAny numerical results shown for this example may differ between platforms as the results depend on the SPICE kernels used as input and the machine specific arithmetic implementation. Create a three-segment DSK file using plate model data for Phobos. Use latitudinal, rectangular, and planetodetic coordinates in the respective segments. This is not a realistic example, but it serves to demonstrate use of the supported coordinate systems. For simplicity, use an existing DSK file to provide the input plate and vertex data. The selected input file has one segment. PRO DSKW02_T ;; ;; IcyUser globally defines DSK parameters. ;; For more information, please see DSKIcyUser.m and ;; DSKIcyUser02.m. ;; @IcyUser SPICETRUE = 1L NSEG = 3 cornam = [ 'radius', 'Z-coordinate', 'Z-coordinate', 'altitude'] ;; ;; Assign names of input and output DSK files. ;; indsk = 'phobos_3_3.bds' dsk = 'phobos_3_3_3seg.bds' if ( cspice_exists(dsk) ) then begin file_delete, dsk endif ;; ;; Open input DSK for read access; find first segment. ;; cspice_dasopr, indsk, inhan cspice_dlabfs, inhan, dladsc, found ;; ;; Fetch vertices and plates from input DSK file. ;; ;; Note that vertex and plate indices are 1-based. ;; print, 'Reading input data...' cspice_dskv02, inhan, dladsc, 1, SPICE_DSK02_MAXVRT, vrtces cspice_dskp02, inhan, dladsc, 1, SPICE_DSK02_MAXPLT, plates print, 'Done.' ;; ;; Set input array sizes required by ## ParticularsUsers planning to create DSK files should consider whether the SPICE DSK creation utility MKDSK may be suitable for their needs. This routine supports use of the DSK type 2 segment writer cspice_dskw02 by creating the "spatial index" arrays required as inputs to that routine. A spatial index is a group of data structures that facilitates rapid high-level computations involving sets of plates. The data structures created by this routine are aggregated into arrays of type SpiceInt and type SpiceDouble. Voxel grids =========== A key geometric computation---probably the most important, as it serves as a foundation for other high-level computations---is finding the intersection of a ray with the plate set. DSK type 2 segments use data structures called "voxel grids" as part of their indexing mechanism. There is a "coarse grid": a box that completely encloses a DSK type 2 segment's plate set, and which is composed of identically-sized cubes called "coarse voxels." Each coarse voxel in composed of smaller cubes called "fine voxels." When the term "voxel" is used without qualification, it refers to fine voxels. Type 2 DSK segments contain data structures that associate plates with the fine voxels intersected by those plates. These structures enable the type 2 DSK software to rapidly find plates in a given region of space. Voxel scales ============ There are two voxel scales: - The coarse voxel scale is the integer ratio of the edge length of a coarse voxel to the edge length of a fine voxel - The fine voxel scale is the double precision ratio of the edge length of a fine voxel to the average extent of the plates in the input plate set. "Extents" of a plate are the absolute values of the differences between the respective maximum and minimum X, Y, and Z coordinates of the plate's vertices. Voxel scales determine the resolution of the voxel grid. Voxel scales must be chosen to satisfy size constraints and provide reasonable plate lookup performance. The following considerations apply to spatial indexes of type 2 DSK segments: 1) The maximum number of coarse voxels is fixed at SPICE_DSK02_MAXCGR (declared in SpiceDSK.h). 2) If there are too few fine voxels, the average number of plates per fine voxel will be very large. This largely negates the performance improvement afforded by having an index. Also, the number of plates per voxel may exceed limits imposed by DSK subroutines that use static arrays. 3) If there are too many fine voxels, the average number of voxels intersected by a given plate may be too large for all the plate-voxel associations to be stored. In addition, the time needed to examine the plate lists for each voxel (including the empty ones) may become quite large, again negating the value of the index. In many cases, voxel scales yielding optimum performance must be determined by experiment. However, the following heuristics can provide reasonable starting values: Let `np' be the number of plates. Let `fs' be the fine voxel scale. Then a reasonable value of `fs' may be (0.25) fs = np / 8. In general, `fs' should not smaller than 1. ## Required ReadingICY.REQ DAS.REQ DSK.REQ ## Version-Icy Version 1.0.0, 13-DEC-2016, ML (JPL), EDW (JPL) ## Index_Entriesmake spatial index for type 2 dsk segment |

Wed Apr 5 17:58:00 2017