kobject kgeom_set_attributes(
kobject object,
int primitive,
kvalist)
KGEOM_OBJECT
for
this argument. Primitive-level
attributes can be set by passing in the
appropriate primitive for this argument.
The current primitive is determined by
the KGEOM_PRIMITIVE_POSITION
attribute.
If the primitive at the current position has
not yet been set, this set attributes call
will set it.
The variable argument list takes the form:
ATTRIBUTE_NAME1, value1 [, value2, ...],
ATTRIBUTE_NAME2, value1,[, value2, ...],
..., NULL
The number of value arguments in the variable argument list for each attribute depends on the attribute. The NULL at the end of the variable argument list serves as a flag indicating the end of the list.
Be careful not to forget the NULL at the end of the list. This is a common programming error which unfortunately will not generate any compiler warnings.
none
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
.
The following example illustrates the use of a single set attributes call to assign two different attributes.
float min[3] = {0.0, 0.0, 0.0};
float max[3] = {200.0, 123.0, 300.0};
kgeom_set_attributes(object, KGEOM_OBJECT,
KGEOM_BOUNDING_BOX, min, max,
KGEOM_NAME, "Isosurface 1",
NULL);
A complete list of geometry attributes and primitives can be found in Chapter 3 of Programming Services Volume II.
none
none
kgeom_set_attributes
call will produce
incorrect results.
$DATASERV/objects/library/koldgeom/src/geometry.c