patriciogonzalezvivo / hilma

library to generate 2D/3D geometries

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

HILMA

Hilma is 3D geometry library in C++ with Python bindings (with support for Numpy) ready to be embed into your projects.

Dependencies:

Compile and install Hilma

  1. Before compiling install dependencies:
// In linux
sudo apt install libglm-dev cmake swig python3-numpy  

// In MacOS
brew install glm cmake swig
brew install --build-from-source open-image-denoise
  1. Then compile
mkdir build
cd build
cmake ..
make
sudo make install 

Note: to install inside anaconda do:

swig -c++ -python hilma.i
/anaconda3/bin/./python3.7 setup.py build_ext --inplace
/anaconda3/bin/./python3.7 setup.py install 

Hilma as C++ lib

Alternatively to installing Hilma on your system you can easily copy the content of include/ and src/ folder to your project, just make sure you

#include "hilma/types/mesh.h"
#include "hilma/io/ply.h"

int main(int argc, char **argv) {

    float vertices[][2] = { {-1.0, -1.0} , {-1.0, 1.0} , {1.0, 1.0}, {1.0, -1.0} };
    int indices[][3] = { {1, 0, 3}, {1, 3, 2 } };

    hilma::Mesh mesh;
    mesh.addVertices( &vertices[0][0], 4, 2);
    mesh.addIndices( &indices[0][0], 2, 3);
    hilma::savePly("rect.ply", mesh, false);

    return 1;
}

Hilma as Python module

First you need to create the package and install it

sudo apt install swig
make install

Then you can use it as follow:

from hilma import Mesh, savePly

mesh = Mesh()
mesh.addVertices( [ [-1.0, -1.0], [-1.0, 1.0], [1.0, 1.0], [1.0, -1.0] ] )
mesh.addIndices( [( 1, 0, 3 ), (1, 3, 2)] ) 
savePly("rect.ply", mesh, False)

Acknowledgements

Some of the code is based or depends 3rd party libraries such us:

License

HILMA is dual-licensed under the Prosperity License and the Patron License for sponsors and contributors.

Sponsors and contributors will be added to the Patron License and they can ignore the any non-commercial rule of the Prosperity Licensed.

About

library to generate 2D/3D geometries

License:Other


Languages

Language:C++ 79.0%Language:C 18.9%Language:SWIG 1.6%Language:Python 0.3%Language:CMake 0.2%