<!--
{
  "availability" : [
    "iOS: 9.0.0 -",
    "iPadOS: 9.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.11.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "ModelIO",
  "identifier" : "/documentation/ModelIO/MDLVoxelArray/union(with:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Model I/O"
    ],
    "preciseIdentifier" : "c:objc(cs)MDLVoxelArray(im)unionWithVoxels:"
  },
  "title" : "union(with:)"
}
-->

# union(with:)

Extends the voxel array to also cover the volume of the specified voxel array.

```
func union(with voxels: MDLVoxelArray)
```

## Parameters

`voxels`

The voxel array to combine with this voxel array.

## Discussion

After a union operation, the voxel array contains voxels that were present either in the original array or in the specified array. That is, a union operation creates a voxel array that combines two volumes.

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`](/documentation/ModelIO/MDLVoxelIndex) value in the voxel array is reset to 0.)

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)