#include <cx/Geometry.h>enum cxGeoSplatType { CX_GEO_SPLAT_POINT, CX_GEO_SPLAT_CONSTANT, CX_GEO_SPLAT_LINEAR, CX_GEO_SPLAT_GAUSSIAN, CX_GEO_SPLAT_TEXTURE };
cxGeo cxGeoOctreeDefine(int nIndices, long *octreeIndex, int numAttributes, float *point, float *voxelSize, float xmin, float ymin, float zmin, float xmax, float ymax, float zmax, float oxmin,float oymin, float ozmin, float oxmax, float oymax, float ozmax, cxGeoSplatType splatType, float splatSize, int radSamples, int aziSamples)
integer CX_GEO_SPLAT_POINT integer CX_GEO_SPLAT_CONSTANT integer CX_GEO_SPLAT_LINEAR integer CX_GEO_SPLAT_GAUSSIAN integer CX_GEO_SPLAT_TEXTUREparameter (CX_GEO_SPLAT_POINT = 0) parameter (CX_GEO_SPLAT_CONSTANT = 1) parameter (CX_GEO_SPLAT_LINEAR = 2) parameter (CX_GEO_SPLAT_GAUSSIAN = 3) parameter (CX_GEO_SPLAT_TEXTURE = 4)
integer function cxGeoOctreeDefine(nIndices,octreeIndex, numAttributes, point, voxelSize, xmin, ymin, zmin, xmax, ymax, zmax, oxmin, oymin, ozmin, oxmax, oymax, ozmax, splatType, splatSize, radSamples, aziSamples) integer nIndices, octreeIndex, numAttributes real point(3,*), voxelsize(numAttributes) real xmin, ymin, zmin, xmax, ymax, zmax real oxmin, oymin, ozmin, oxmax, oymax, ozmax integer splatType, radSamples, aziSamples real splatSize
Briefly, each leaf in the octree contains information about the color, transparency, location, and size of the node. A screen-oriented "splat" is drawn for each leaf node, using this specification.
The octree shape is encoded into the linear array octreeIndex, which is organized as follows:
Each entry of the octree is either a leaf node or a branch. Leaf nodes are represented by a non-negative number whose value indexes into the color, transparency, location, and voxel size of the node. Location and voxel size if specified, are passed through point and voxelSize. Use cxGeoColorAdd(3E) and cxGeoTransparencyAdd(3E) to set color and transparency attributes.
If the entry is a negative number, then the absolute value of that entry is the relative offset to the eight child nodes of that branch. For example, the first entry in the octree is a branch node whose value is -1 (its children are 1 index away from the current location).
The special leaf node index of zero inhibits drawing of a leaf node, so the first color, transparency, location, and voxel size attributes will be ignored. The total number of indices in octreeIndex should be nIndices.
The numAttributes argument specifies the number of unique attributes in the point and voxelSize arrays (this number should be less than or equal to the number of leaf nodes). point is an array of coordinate triplets (x,y,z) for the location of each leaf node. It can be NULL, in which case the octree is assumed to be uniform, and the location is determined from the bounding box arguments, xmin, ymin, zmin, xmax, ymax, zmax. voxelSize is an array of floats with one value for each voxel. This is a scaling factor for the polygonal splat which is used for all voxels (this can also be NULL, in which case it is assumed to be unity for all voxels).
The splatType can be of the following types, in increasing complexity:
splatSize is the size of the splat in world space, unless the splat is of type CX_GEO_SPLAT_POINT in which case it is in pixels. Two arguments govern the tessellation of the splat: radSamples and aziSamples. radSamples is the number of radial samples in the reconstruction function. It should be 1 for CX_GEO_SPLAT_LINEAR and greater than 1 for CX_GEO_SPLAT_GAUSSIAN. The ideal value for CX_GEO_SPLAT_TEXTURE is 1.6. aziSamples is the number of azimuthal samples, which should be 3 or greater and only affects linear or Gaussian reconstruction).
Note that both the bounding box of the volume and the bounding box of the octree are specified independently. This is so that any padding of the data samples, e.g. to a power of two, can be accounted for.