DATASERV (kgeom) functions


LIBRARY ROUTINE

kgeom_get_primitive - get a primitive from a geometry object

LIBRARY CALL

kgeom_primitive *
kgeom_get_primitive(
   kgeom_object *object,
   int           position)

INPUT

OUTPUT

none

RETURN VALUE

TRUE on success, FALSE on failure

DESCRIPTION

This routine will get the primitive from the specified position in the primitive list. If the position is outside the bounds of the primitive list then a NULL pointer will be returned.

Geometry Primitives and Primitive Lists

A geometry primitive contains geometric data which describes a shape in space. Lines, triangles, and spheres, are all considered to be geometric primitives. For a complete description of all the geometry primitives, see the kgeom_primitive man page.

Each geometry object contains a list of such geometry primitives. New primitives can be created using the function kgeom_new_primitive(). Once a new primitive has been created and its data assigned, it can be added to the primitive list of the object using the function kgeom_add_primitive(). A corresponding function kgeom_remove_primitive() allows you to remove a primitive from the primitive list of an object. The number of primitives which have been added to the primitive list of an object is returned by the function kgeom_number_primitives().

The primitive functions should be the only means used for accessing the primitives on a primitive list. Even though the primitive list of the geometry object could be acccessed directly, it should be considered to be private. By using the primitive list function calls, you can be certain to maintain the integrity of the primitive list.

ADDITIONAL INFORMATION

Note that if the primitive being returned is another geometry object, then the return value should be cast to \f(CWkgeom_object *fP before assigning it to a geometry object variable.

EXAMPLES

none

SIDE EFFECTS

none

RESTRICTIONS

none

MODIFICATION

none

FILES

$DATASERV/objects/library/kgeom/src/object.c

SEE ALSO

kgeom(3), kgeom_primitive, kgeom_new_primitive, kgeom_blast_primitive, kgeom_add_primitive, kgeom_remove_primitive, kgeom_number_primitives

COPYRIGHT

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