Friday, November 14, 2014

Graphics: Marching Cubes - Implementation

A javascript implementation of the Marching cubes algorithm...

1- Description


Fig.1: The originally published 15 cube configurations. By Jmtrivial (License GPL, [Wikipedia])

2-  The script

In the last update of ImageJ (version 1.49k), it is now possible to call multiple files in a script.
Note: [2018/04/03] The code is updated for ES6 (2015+) JavaScript
However, this feature is only available for java Sun/Oracle (it does not seem to work with OpenJDK). In this case, copy and paste the contents of the two scripts marchingCubes_Cube.js and marchingCubes_Slice.js in the main script.

This - long - script is divided in three parts:
  • the class Cube for computing the configuration case and vertices along the edges.
  • the class Slice involved in the storage of temporary cubes
  • the main script marchingCubes.js

class Cube
+++ Javascript: MarchingCubes_Cube.js +++
+++ End of Script: +++

class Slice
+++ Javascript: MarchingCubes_Slice.js +++
+++ End of Script +++

Main Script
+++ Javascript: MarchingCubes_Slice.js +++
+++ End of Script +++

Hope that helps.

<<  Previous: Principle Next: Render in Blender >>

3. Other crazybiocomputing posts

Further readings are available in ...
  • Computer Graphics Series  [Link]
  • Image Processing TOC [Link]

No comments:

Post a Comment