/MACE

Mesh Adaptation through Configurational Energy

Primary LanguagePythonGNU General Public License v3.0GPL-3.0

MACE - Mesh Adaptation through Configurational Energy

MACE is a sophisticated algorithm designed to optimize and reconstruct surfaces from point clouds by leveraging the principles of configurational energy. This project encapsulates the core of what makes dynamic mesh adaptation possible, providing users with the tools to transform chaotic sets of points into structured, optimized meshes. Ideal for applications in computational geometry, graphics, and scientific visualization, MACE bridges the gap between raw data and geometry. It could also be potentially used as a remesher in the video game industry. It was originally developed as a way to get a set of points defining a surface when given a set of points defining a 'thick' surface which would throw off any triangulation technique.

As it stands, it could use some optimization, but it is a proof of concept and demonstrates how simulated annealing can be used for such a purpose. Perhaps in the future adding a penalty to the objective function for points being too close is a good idea :)

Features

  • Point Cloud to Mesh Conversion: Convert unstructured point clouds into structured mesh representations.
  • Energy-Based Optimization: Utilize configurational energy principles to optimize the placement and connectivity of mesh points.
  • Adaptive Meshing: Dynamically adjust mesh density and structure based on local geometric features.
  • Interactive Visualization: Explore the evolution of mesh adaptation through an interactive interface.

Installation

To get started with MACE, clone this repository, setup your environment, then try python setup.py install or python setup.py develop

Running MACE

Load your point cloud (example)

import numpy as np
points = np.random.rand(100, 3)  # Example point cloud data, which we want to fit a surface to

# Initialize MACE
import mace
mace_inst = MeshAdaptation(points)

# Run the optimization
# MACE by default contracts points on the boundary of a box to the generate a surface on the set of points you gave it.
optimized_mesh = mace_inst.simulated_annealing(points) 

# Loading MACE data
mace.load_configurations(file_path)

Example of the Contraction or Vacuuming Forming:

This code can be found in the notebook in the examples directory

Before (box initial starting points)

After 28 Iterations

We begin to converge to the set of 'thick' points defined by the data. It now looks more like a fermi surface :)

Advanced Usage

For advanced configurations and usage scenarios, please refer to the documentation or the examples directory in this repository. Including the widgets given above.