shrey16 / caustic_based_surface_generation

Implementation of the paper http://www.cs.columbia.edu/~yonghao/tog14/yue-continuous-caustics-lens.pdf
4 stars 5 forks source link

This code is a reproduction of the paper "Poisson-Based Continuous Surface Generation for Goal-Based Caustics" by Yue et al. 2014.

Dependecies:

  1. numpy
  2. scipy
  3. matplotlib
  4. open3d (for generating the Surface)

The code is provided in the file 'c.py'. The user needs to provide the location of an input image file, of size exactly 512x512, in either jpg or gif format. This can be done by directly updating the img_location parameter in the c.py file. The various functions in the code have been explained in Appendix A of the report already sent. Once it starts running, it will write status updates to the command line, but will not require any new inputs. Upon completion, the user will see a support folder which create various files, listed below:

  1. h_{i}.txt: This is the height profile calculated at the i-th iteration. Its an array of 512x512 and gives the height of the surface at each point, in mm.

  2. areas_dst.txt: This file gives the areas around each point on the target screen. Its a single array containing 512*512 entries.

  3. D_{i}.txt: This files contains the difference matrix calculated at the i-th iteration. Its an array of size 512x512.

  4. delT.txt: This file gives the values of delT calculated during computation.

  5. div_{i}.txt: This file gives the divergence of the normals used during surface computation. Its an array of size 512x512.

  6. iter_{i}.jpg: This file shows the mesh at each iteration. Its a picture file. Note: Pictures will appear rotated by 90 deg. This is due to how numpy handles rewrapping arrays in different sizes.

  7. phi_{i}.txt: This if the pressure field phi at each iteration. Its an array of 512x512.

  8. source_{i}.txt: This file contains the location of mesh points as a single array of length 512*512.

  9. Other miscellaneous files generated by KeyShot during rendering.

After the support files are generated, the user can use the create_surface.py script to generate an stl object of the 3d surface. The script requires the open3d library to be installed which can be done with

pip(or pip3) install open3d

This file uses the h_15.txt and source_13.txt files from the support folder to generate bpa_mesh.stl object file which can then be imported in various 3d graphics renderers to render the surface.

The directory also contains a samples folder which includes 6 examples for which the script has already been run and surfaces have been rendered.

Lastly, my futile attempts to implement the galerkin method are captured in the file gallerkin.py. It requires a difference matrix to work which can be provided directly in the code. It also requires the scikits.umfpack in order to solve the system of linear equations. It outputs three files:

  1. S.npz: contains the S matrix in sparse format.
  2. g.txt: contains the g vector.
  3. phi_galerkin.txt: contains the solution to the system Su = g.