3d Numpy array in -> Voxel world out
![image](https://private-user-images.githubusercontent.com/1865834/341840048-680dcde4-299e-4508-8cb7-1779831b1b98.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjU0MTg2OTQsIm5iZiI6MTcyNTQxODM5NCwicGF0aCI6Ii8xODY1ODM0LzM0MTg0MDA0OC02ODBkY2RlNC0yOTllLTQ1MDgtOGNiNy0xNzc5ODMxYjFiOTgucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDkwNCUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA5MDRUMDI1MzE0WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9MWZhNDRhZjM4NTFlNjNmZmFlNzA0MzYxMzIxOWFkMDM2ZGVmMjU3MzYzZDIyYTYxZjhlMTYwNDdjZmM1MjRjOSZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.DE2ySSZuKtPZHeZJyVgOHelnf5CJ7e80ehNvqWgViIA)
pip3 install voxel_world
git clone https://github.com/jackparmer/VoxelWorld.git
cd VoxelWorld
python3 -m pip install .
from voxel_world import VoxelWorld
For physics simulation, computer vision, games, art, whatever
Features!
- Automatic GIF generation
- Simple! Numpy 3d ones array in -> Voxel world out
- Portable! Outputs images or standalone HTML files with Vixel
- Notebooks! Works well in the Jupyter notebook ecosystem
- Eye candy! Ambient occlusion, ray tracing from Vixel, etc
from voxel_world import Volume, Surface;
volume = Volume(Volume.purlin_matrix(32)); surf = Surface(volume)
surf.color = (255,0,0)
volume.add(surf).show()
![image](https://private-user-images.githubusercontent.com/1865834/346349636-4a9c5f99-4ff2-441b-9086-fac3c4e7132a.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjU0MTg2OTQsIm5iZiI6MTcyNTQxODM5NCwicGF0aCI6Ii8xODY1ODM0LzM0NjM0OTYzNi00YTljNWY5OS00ZmYyLTQ0MWItOTA4Ni1mYWMzYzRlNzEzMmEucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDkwNCUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA5MDRUMDI1MzE0WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9MTgzZDBkMmY1ZWY0MDQ5NDZmMzFkNDJhNmQ1NjE0OGU1ZjQwNDFhZWUzZWZlZjU2NjIxOWJjNjgyZGViZTlmMSZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.kzKdj27_QtlnUzE9yN4PicjXbmBpWWoukJS2MFVDMBk)
import random
from voxel_world import Volume
Volume(
Volume.purlin_matrix(16),
theme=random.choice(list(Volume.themes.keys())),
viewing_angle=(random.randint(0, 90), random.randint(0, 90)),
).render().show()
![image](https://private-user-images.githubusercontent.com/1865834/346349524-80ad3ed5-15f2-427f-9608-72a46b07e932.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjU0MTg2OTQsIm5iZiI6MTcyNTQxODM5NCwicGF0aCI6Ii8xODY1ODM0LzM0NjM0OTUyNC04MGFkM2VkNS0xNWYyLTQyN2YtOTYwOC03MmE0NmIwN2U5MzIucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDkwNCUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA5MDRUMDI1MzE0WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9YTQzODgzZGNjYjJlOGVkMDg2YTI4YWFkN2RkNDU5NGYzZThjMDY4MjI2NjU1NzQ2MDUxZWE4M2ExYWE5MDQ1NyZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.n4-AzvyYK2pBNlARolzY3X-yJtKieuGDyvFMo8l0yqU)
from voxel_world import Volume, Vixel; vw = Volume(); vix = Vixel(vw); vix.html()
![image](https://private-user-images.githubusercontent.com/1865834/346349940-90826a0c-6d74-4956-acd1-fa230a79c9da.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjU0MTg2OTQsIm5iZiI6MTcyNTQxODM5NCwicGF0aCI6Ii8xODY1ODM0LzM0NjM0OTk0MC05MDgyNmEwYy02ZDc0LTQ5NTYtYWNkMS1mYTIzMGE3OWM5ZGEucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDkwNCUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA5MDRUMDI1MzE0WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9MGFhZmVkYzI2YWMxZjdhNWVjYTMyZWYyMWY0NzFlOGZjZDA4ODdhZjc5YzM2OWU4NTA3MmZmYTBjNDRiNmRhMSZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.W-NQYPFyqvh_jwXHN02B-wbDqhpv5O7OCrDOJ0wXzsM)
from voxel_world import Volume, Surface, Agent, Sequence
volume = Volume(Volume.purlin_matrix(64));
surf = Surface(volume);
agents = [Agent(surf, mask) for mask in Sequence.snake(grid_size=64, num_steps=1000)];
seq = Sequence(agents);
seq2 = seq.apply_bg(volume)
seq2.save('voxel_animation64_v2.gif')
![image](https://private-user-images.githubusercontent.com/1865834/340759559-917f38ac-dd26-4419-9725-0693ca05aaa1.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjU0MTg2OTQsIm5iZiI6MTcyNTQxODM5NCwicGF0aCI6Ii8xODY1ODM0LzM0MDc1OTU1OS05MTdmMzhhYy1kZDI2LTQ0MTktOTcyNS0wNjkzY2EwNWFhYTEucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDkwNCUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA5MDRUMDI1MzE0WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9YzExMGY1YjJjNTFkNzVlYzdlOThlMWY5ZTc1MzUwNzA1ZGQ2MzQwNmUwMmQ3NTExOWQ3YjhiMzgzYmZiNDRlYSZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.WJkvqDLYljzbA45FQGomacoDQUxZCQPPSWK-5P2KFYE)
![image](https://private-user-images.githubusercontent.com/1865834/340432642-f2a61fae-5133-4e2c-8bf9-71e69c1d0948.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjU0MTg2OTQsIm5iZiI6MTcyNTQxODM5NCwicGF0aCI6Ii8xODY1ODM0LzM0MDQzMjY0Mi1mMmE2MWZhZS01MTMzLTRlMmMtOGJmOS03MWU2OWMxZDA5NDgucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDkwNCUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA5MDRUMDI1MzE0WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9MDNmMWY5NDk4N2M0MGZmZDYxYThlYTNmNThlNmRlZDVhZTk3YzczMmYwZGVjYWUzZTgyNWNkM2YyYjNhMjhmMiZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.J3KcBsPlJ8FoRC5EIr72GMFiaO1SmWpbJoXxlQWdSoc)
![image](https://private-user-images.githubusercontent.com/1865834/340433505-d86f3e6a-322a-4273-8260-fc41fb215eaf.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjU0MTg2OTQsIm5iZiI6MTcyNTQxODM5NCwicGF0aCI6Ii8xODY1ODM0LzM0MDQzMzUwNS1kODZmM2U2YS0zMjJhLTQyNzMtODI2MC1mYzQxZmIyMTVlYWYucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDkwNCUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA5MDRUMDI1MzE0WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9Y2E3Y2UwMjhlZDBmNjJmMjNiMDNjYmY1N2JiZmMxZjI2NTk4MDE4YjIxNjU4MTM2MjA2MDA3MGRlNDc2YTk1MyZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.44HI6aqMe-x-zRkpWwMnA-_-ObgNx53I49wpNOxafUc)
python3 -m build
python3 -m twine upload --repository-url https://upload.pypi.org/legacy/ dist/*