Code Monkey home page Code Monkey logo

voxelmap's Introduction

voxelmap

License Documentation Status

A Python library for making voxel and three-dimensional models from NumPy arrays.

Installation and Local Usage

pip install voxelmap

It is recommended you run voxelmap using a virtualenv virtual environment. To do so, follow the below simple protocol to create the virtual environment, run it, and install the package there:

virtualenv venv
source venv/bin/activate
pip install voxelmap
python [your-voxelmap-script.py]

To exit the virtual environment, simply type deactivate. To access it at any other time again, enter with the above source venv... command.

Just starting? Check out our documentation for installation and usage examples

Disclaimer: Use At Your Own Risk

This program is free software. It comes without any warranty, to the extent permitted by applicable law. You can redistribute it and/or modify it under the terms of the MIT LICENSE, as published by Andrew Garcia. See LICENSE below for more details.

MIT license Copyright 2022 © Andrew Garcia.

voxelmap's People

Contributors

andrewrgarcia avatar dependabot[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

voxelmap's Issues

Will it work for negative axes?

HI,
Thank you for the library. Is it possible to plot voxels on negative axes? I have some points on negative x, y and z axes. Is it possible to plot them? If so, can you please share an example?

Thank you

test_image: "3d-mapping" of land.png

Find source and correct following:

libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: cHRM chunk does not match sRGB

to reproduce:

run python setup.py test and wait for test_image() output.

Import Blender models capability

Implement a framework to import and process blender models to pixelated models, as integer arrays. This may be done in a manner analogous to the voxelmap/goxel.py sub-module for Goxel .txt files, though the code may be more complex due to the binary format of .blend files.

Draw at proper 3D orientation - patch for voxelmap.Model().draw()

Fix the make() function from the Model class to draw 3D models with the same orientation as its multidimensional array.

The current 'quick-fix' is to swap the axes of the array so that the model draws at the correct orientation by using
array = np.transpose(array,(2,1,0)) or a variation thereof. This is merely a band-aid solution and the bug must be fixed at its source, which I believe is voxelmap.Model().draw() function, though it may be a combination of this one and others as well.

Direct transfer of voxel colors from external file (e.g. Goxel --> .txt) to voxelmap model by default

Currently, external files are imported into a voxelmap (vxm) model by the vxm.Goxel() structure. For this, its function vxm.Goxel().update_colors() must be used to map the RRGGBB hexanumerical voxel colors of the imported file to a specific integer, i.e. :

gox = vxm.Goxel('your-imported-file.txt')
gox.update_colors('8f563b',1)
gox.update_colors('ac3232',2)
gox.update_colors('000000',3)
array = gox.importfile()      # turn txt file to array

If the voxel coloring is intended to be made the same in the Python voxel draw as in the original model, they must then be defined, once again, in the vxm.Model() structure with its vxm.Model().customadd() function:

'load array to voxelmap Model'
model = vxm.Model(array)

'draw with same voxel colors as original external file '
model.customadd(1,'#8f563b')
model.customadd(2,'#ac3232')
model.customadd(3,'#000000')
model.draw('voxels')

Develop a medium which automatically defines the voxel colors of the external file into the Model structure by default.
i.e. gox.update_colors('8f563b',1) --> model.customadd(1,'#8f563b'); ...

Implement a three-dimensional Convex Hull algorithm to process voxels at the surface of voxel models from Goxel imports

Some 3D models may have internal voxels which are not seen and are thus a waste of memory, computation-wise.

A 3D Convex Hull algorithm will process the external voxels which are visible alone.

This will reduce the time complexities of rendering and dynamic manipulation of 3D objects with "n" lengths from O(n^3) to O(n^2) for cases where internal voxels are present.

While a Jarvis algorithm wraps all points by considering the most counterclockwise trios:
sketches(1)

A 3-D Convex Hull algorithm will generate a hull from an initial triangle plane of 3 voxels and pivot around the external points in 3-D space until the hull closes:

sketches

Some useful references:
https://www.cs.jhu.edu/~misha/Spring16/09.pdf

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.