Skip to main content

A high-performance Python package for efficient voxel and mesh model creation, with C++ backend.

Project description

VoxelForge is a high-performance Python package written in C++ for creating and manipulating voxel models with advanced spatial data structures like octrees and graph representations. Designed to facilitate integration with machine learning and deep learning workflows, VoxelForge is ideal for applications that require complex spatial data processing and analysis.

Key Features

  • Efficient voxel manipulation and storage using C++.
  • Spatial indexing with octree structures for fast query performance.
  • Integration of voxel data into graph structures for advanced modeling and analysis.
  • Flexible data identity for voxels, supporting simple integers by default or complex data types like strings and dictionaries.

Installation

Install VoxelForge easily using pip:

pip install VoxelForge

Building from Source

If you prefer to build VoxelForge from source, detailed instructions are available in the BUILD.md file.

In summary, you'll need to:

  1. Clean the build directory.
  2. Configure the project using CMake.
  3. Build the project with make.
  4. Reinstall the package locally using pip install ..

For complete step-by-step instructions, please refer to the BUILD.md file.

Usage

Basic Voxel Operations

import voxelforge as vf

# Create a new VoxelGrid and add a voxel with default identity
grid = vf.VoxelGrid()
grid.addVoxel(1, 2, 3)  # Adds a voxel with default identity 1

# Retrieve and display voxel information
voxels = grid.getVoxels()
for voxel in voxels:
    print(f'Voxel at ({voxel.x}, {voxel.y}, {voxel.z})')

Handling Various Data Identities

# Create another VoxelGrid for handling different identities
advanced_grid = vf.VoxelGrid()
advanced_grid.addVoxel(6, 6, 6, "Santa")
advanced_grid.addVoxel(7, 8, 9, {"color": "#001230", "alpha": 0.12, "gravity": 0.81  })

# Retrieve and display voxel information with identities
advanced_voxels = advanced_grid.getVoxels()
for voxel in advanced_voxels:
    print(f'Voxel at ({voxel.x}, {voxel.y}, {voxel.z}) with data {voxel.data}')

Advanced Graph Features

# Convert VoxelGrid to a graph structure with specified dimensions and neighboring radius
graph_data = advanced_grid.toTorchGraph(xDim=10, yDim=10, zDim=10, neighboring_radius=1.0)

# Access node features and edge indexes from the graph
print("Node Features:", graph_data['x'])
print("Edge Index:", graph_data['edge_index'])

Using Octree for Spatial Indexing

# Initialize an Octree with a specific size and depth
octree = vf.Octree(origin=np.array([0.0, 0.0, 0.0]), size=10.0, max_depth=3)

# Insert points and locate leaf nodes
octree.insert_point(np.array([1.0, 1.0, 1.0]))
leaf_node = octree.locate_leaf_node(np.array([1.0, 1.0, 1.0]))

if leaf_node:
    print(f"Leaf node found at {leaf_node.get_point()}")

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

voxelforge-0.1.1.tar.gz (10.1 kB view details)

Uploaded Source

File details

Details for the file voxelforge-0.1.1.tar.gz.

File metadata

  • Download URL: voxelforge-0.1.1.tar.gz
  • Upload date:
  • Size: 10.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.11

File hashes

Hashes for voxelforge-0.1.1.tar.gz
Algorithm Hash digest
SHA256 7d0b63f7936b2faba97c513fed0c2675c22b50920f0023178309ba5e399a42c3
MD5 fca988109873eb542062e64bebbdf395
BLAKE2b-256 16eaaccae15d472013943ea694205f52eccf661e3f6e4e68d5abae16cd238249

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page