DATASERV (koldgeom) functions


LIBRARY ROUTINE

kgeom_get_attributes - get the values of a number of geometry attributes.

LIBRARY CALL

kobject kgeom_get_attributes(
   kobject object,
   int     primitive,
   kvalist)

INPUT

OUTPUT

RETURN VALUE

TRUE (1) on success, FALSE (0) otherwise

DESCRIPTION

This function is used to retrieve the values of an arbitrary number of attributes associated with a data object containing geometry data.

Attributes can be either global to the object, or specific to a primitive contained within the object. Attributes which are global are termed object-level, and attributes specific to a primitive are termed primitive-level.

Object-level attributes apply globally to all primitives contained within a data object. Two examples of object-level attributes are KGEOM_NAME, which is the name of the object, and KGEOM_AMBIENT, which dictates how the geometry should react to ambient light sources.

Primitive-level attributes apply only to the current primitive as indicated by the KGEOM_PRIMITIVE_POSITION attribute. An example of such an attribute is the KGEOM_NUMBER attribute which determines the number of vertices in the current primitive.

Attributes may have multiple components. For example, the attribute KGEOM_BOUNDING_BOX consists of two components, one component being the minimum point of the bounding box, and the second component being the maximum point of the bounding box.

Some of the geometry attributes have varying data types and sizes depending on the values of other attributes. For example, the KGEOM_CENTER attribute must be set with an array of the data type indicated by the attribute KGEOM_LOCATION_DATA_TYPE that contains the number of values indicated by the attribute KGEOM_LOCATION_SIZE. Changes in the attributes which determine the type or the size of another attribute will cause the dependent attribute to be recast or resized.

Note that any array attributes, such as strings, which are retrieved should not be altered or freed. The pointer returned points to the actual internal storage array. A copy should be made if the values need to be changed.

The following example illustrates the use of a single get attributes call to retrieve two different attributes.

float *min; float *max; char *name;

kgeom_get_attributes(object, KGEOM_OBJECT, KGEOM_BOUNDING_BOX, &min, &max, KGEOM_NAME, &name, NULL);

A complete list of geometry attributes and primitives can be found in Chapter 3 of Programming Services Volume II.

ADDITIONAL INFORMATION

none

EXAMPLES

none

SIDE EFFECTS

none

RESTRICTIONS

Calling this function with an incorrect number of arguments in the variable argument list will not cause any compiler errors, but will often generate a segmentation fault. Also, mixing object and primitive level attributes on a single kgeom_get_attributes call will produce incorrect results.

MODIFICATION

none

FILES

$DATASERV/objects/library/koldgeom/src/geometry.c

SEE ALSO

koldgeom(3)

COPYRIGHT

Copyright (C) 1993 - 1997, Khoral Research, Inc. ("KRI") All rights reserved.