---
title: "difference(with:)"
framework: modelio
role: symbol
role_heading: Instance Method
path: "modelio/mdlvoxelarray/difference(with:)"
---

# difference(with:)

Reduces the voxel array to cover only the portion of its volume not covered by another voxel array.

## Declaration

```swift
func difference(with voxels: MDLVoxelArray)
```

## Parameters

- `voxels`: The voxel array to subtract from this voxel array.

## Discussion

Discussion After a difference operation, the voxel array contains only those voxels that were present in the original array and not present in the specified array. That is, a difference operation creates a voxel array representing the space where one volume does not overlap another. Performing a union, intersection, or difference operation clears out shell level information from all voxels in the array. (That is, the w component of every MDLVoxelIndex value in the voxel array is reset to 0.)

## See Also

### Performing Constructive Solid Geometry Operations

- [union(with:)](modelio/mdlvoxelarray/union(with:).md)
- [intersect(with:)](modelio/mdlvoxelarray/intersect(with:).md)
