Skip to content

EJRicketts/WeightedVoronoiStipplingMesher

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Weighted Voronoi Stippling Mesher

Information

  • Author: Evan John Ricketts
  • Afffiliation: Cardiff University
  • Date: April 27, 2024

Description

Mesh generator based on weighted voronoi stippling, where an image is taken as input, and its luminosity dictates mesh density.

anim

This can then be used in a number of ways, such as a finite element solver. Below is the solution of Poisson's equation with two souce terms.

skull_FEM-ezgif com-crop

Sources of inspiration

Requirements

  • Python 3.7 or higher
  • Numpy
  • Numba
  • Matplotlib
  • PIL
  • Scipy
  • Tqdm

Usage

The code -with default arguments- can be run from the command line as follows:

python main.py image_name.png

where it is assumed the images is in the images directory.

The following parameters can be parsed

    npoin = 30000       # Number of particles
    niter = 25          # Number of iterations
    save = False        # Save array of final points
    animate = False     # Animate the meshing process
    plot = False        # Plot final mesh
    dpi = 400           # Resolution of plots

Examples

Strawberry

Command: python main.py sbry.jpg --npoin 20000 --niter 25 --plot

original image particles

Random Field 3

Command: python main.py RF3.png --npoin 20000 --niter 25 --plot

original image particles

Skull

Command: python main.py skull.png --npoin 20000 --niter 25 --plot

original image particles

Note

The code is provided as is and the author is not responsible for any damage caused by the code. GPT4 was utilised in the construction of the code.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages