cspice_union

 Abstract I/O Examples Particulars Required Reading Version Index_Entries

#### Abstract

```
CSPICE_UNION computes the union of two sets of any data type to
form a third set.

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

```

#### I/O

```
Given:

a,
b   scalar Icy sets, each of the same type, double precision,
or integer.

The user must create 'a' and 'b' using either
cspice_celld, or cspice_celli.

the call:

cspice_union, a, b, d

returns:

c   a scalar Icy set, distinct from sets 'a' and 'b' but with
the same type, containing the union of 'a' and 'b'
(that is, all of the elements which are in 'a' or
'b' or both).

```

#### Examples

```
Any 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 the cells...
;;
SIZE = 10

a = cspice_celli( SIZE )
b = cspice_celli( SIZE )
c = cspice_celli( SIZE )
d = cspice_celli( SIZE )

e = cspice_celld( SIZE )
f = cspice_celld( SIZE )
g = cspice_celld( SIZE )
h = cspice_celld( SIZE )

;;
;; ... insert the test data so that
;; 'b' = 'c' define strict subsets of 'a'.
;;
cspice_insrti, [ 1l, 2, 3, 4 ], a
cspice_insrti, [ 1l, 3       ], b
cspice_insrti, [ 1l, 3       ], c

cspice_union, a, b, d

;;
;; Output set data array for set 'd'. Recall, the 'base' field
;; describes a vector of length
;;
;;   d.data + cspice_size(d)
;;
;; The set data being a slice of this vector. The slice begins at
;; index:
;;
;;    d.data
;;
;; ending at:
;;
;;    d.data + cspice_card(d) - 1
;;
;; for cspice_card(d) > 0.
;;
print, "Union of a and b", d.base[d.data : d.data+cspice_card(d)-1 ]

cspice_union, b, c, d

print, "Union of b and c", d.base[d.data : d.data+cspice_card(d)-1 ]

print

;;
;; Same example for double precision.
;;
cspice_insrtd, [ 1.d, 2.d, 3.d, 4.d ], e
cspice_insrtd, [ 1.d, 3.d           ], f
cspice_insrtd, [ 1.d, 3.d           ], g

cspice_union, e, f, h

;;
;; Output set data array for set 'h'.
;;
print, "Union of e and f", h.base[h.data : h.data+cspice_card(h)-1 ]

cspice_union, f, g, h

print, "Union of f and g", h.base[h.data : h.data+cspice_card(h)-1 ]

IDL outputs:

Union of a and b     1     2     3     4
Union of b and c     1     3

Union of e and f   1.0000000   2.0000000   3.0000000   4.0000000
Union of f and g   1.0000000   3.0000000

```

#### Particulars

```
The user must create any needed cell structures with cspice_celld,
cspice_celli prior to use regardless of whether the routine
uses the cell as input or returns it as output.

```

```
ICY.REQ
CELLS.REQ
SETS.REQ

```

#### Version

```
-Icy Version 1.0.1, 28-SEP-2006, EDW (JPL)

Corrections to English.
Correct Required Reading citation CELL.REQ to CELLS.REQ.

-Icy Version 1.0.0, 22-AUG-2005, EDW (JPL)

```

#### Index_Entries

```
union of two sets

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