Instance Method

voxelExistsAtIndex:allowAnyX:allowAnyY:allowAnyZ:allowAnyShell:

Returns a Boolean value indicating whether the voxel array contains voxel data for the specified index.

Declaration

- (BOOL)voxelExistsAtIndex:(MDLVoxelIndex)index allowAnyX:(BOOL)allowAnyX allowAnyY:(BOOL)allowAnyY allowAnyZ:(BOOL)allowAnyZ allowAnyShell:(BOOL)allowAnyShell;

Parameters

index

An index describing both the location of the voxel within the three-dimensional grid of the voxel array and its relationship to the volume of the object modeled by the voxel array.

allowAnyX

If YES, this method treats the x component of the index parameter as a wildcard. If NO, this method requires an exact match for the x component.

allowAnyY

If YES, this method treats the y component of the index parameter as a wildcard. If NO, this method requires an exact match for the y component.

allowAnyZ

If YES, this method treats the z component of the index parameter as a wildcard. If NO, this method requires an exact match for the z component.

allowAnyShell

If YES, this method treats the w (shell level) component of the index parameter as a wildcard. If NO, this method requires an exact match for the shell level component.

Return Value

YES if the voxel array contains at least one voxel index matching the specified parameters; otherwise NO.

Discussion

Use the allowAnyX, allowAnyY, allowAnyZ, and allowAnyShell parameters to perform wildcard searches. For example:

// Does a voxel exist at exactly the specified X, Y, Z, and shell level?
exists = [voxelArray voxelExistsAtIndex:index allowAnyX:NO allowAnyY:NO allowAnyZ:NO allowAnyShell:NO];
// Does a voxel exist at the specified X, Y, and Z, regardless of shell level?
exists = [voxelArray voxelExistsAtIndex:index allowAnyX:NO allowAnyY:NO allowAnyZ:NO allowAnyShell:YES];
// Are there surface voxels anywhere on the XY plane at a specific Z index?
index.w = 0;
exists = [voxelArray voxelExistsAtIndex:index allowAnyX:YES allowAnyY:YES allowAnyZ:NO allowAnyShell:NO];
// Are there any voxels three layers deep inside the object modeled by the voxel array, regardless of location?
index.w = -3;
exists = [voxelArray voxelExistsAtIndex:index allowAnyX:YES allowAnyY:YES allowAnyZ:YES allowAnyShell:NO];

See Also

Examining Voxels

count

The number of voxels in the array.

voxelIndexExtent

The indexes that define the corners of the three-dimensional voxel grid.

- voxelsWithinExtent:

Returns a data object containing all voxels within the specified volume.

- voxelIndices

Returns a data object containing all voxels within the voxel array.