    Next: Camera Geometry Up: Geometrical Primitives Previous: Transformations   Contents

## Generic Geometry Functions

The geometrical primitives described above are grouped together in a body of Tina code that is able to treat them generically. These functions use pointers to geometrical rimitives and the following predefined type definitions:

```SCALAR
POINT2
POINT3
LINE2
LINE3
CONIC2
CONIC3
PLANE
TRANSF3
```

Tina functions that apply to generic geometry are prefixed geom_. Some functions may not be defined for all possible types in which case they will have no effect and/or return ULL.

Geometry is often grouped and manipulated using grouping data structures described in other sections of the programmers guide. Most common amongst these is reclist data structure. This allows underlying image structure to be preserved here
it is thought necessary. Some functions, however, only allow simple lists of geometric primitives. Hence conversion is sometimes necessary.

```void   *geom_alloc(unsigned int type, unsigned int internal_type)

void   *geom_copy(void *geom, int type)

void   *geom_update_copy(void *geom, int *type)

void    geom_format(void *geom, unsigned int type)

int     geom_label_get(void *p, int type)

void   *geom_getbylabel(List * geom, int label, int *type)
```

Generic functions for primitive structure manipulation. The function

geom_update_copy is the same as geom_copy in except that it uses a pointer to the type rather than the type itself this allows it to be used in conju ction with reclist and other functions that allow for changes in the form of a structure or the elements it access Eg:

reclist_update and reclist_flat)

geom_label_get recovers the label field of the geometrical primitives they all have one). As they are all unique over all structures) they can be used as a universal
identifier.

```void   *geom_prop_get(void *p, int type, int prop)

void    geom_prop_add(void *geom, int type, void *prop, int prop_type,
void (*freefunc) ( /* ??? */ ))

void    geom_prop_addifnp(void *geom, int type, void *prop, int prop_type,
void (*freefunc) ( /* ??? */ ), Bool dofree)

void   *geom_prop_update_get(void *p, int *type, int prop)
```

Generic property list manipulation functions.

```void    geom_negate(void *geom, int type)

void   *geom_negative(void *geom, int type)

void    geom_transform(void *geom, int type, Transform3 * trans)
```

Generic transformation functions.

```List   *geom_list_make_flat(List * list)

List   *geom_string_make_flat(Tstring * string)
```

Functions to make recursive lists into flat lists. The old recursive list data structure is destroyed but not the elements it points to. They are now pointed to by the new flat list data structure.    Next: Camera Geometry Up: Geometrical Primitives Previous: Transformations   Contents
root 2019-03-24