Skip to content
/ dfmesh Public
forked from sugatoray/dmsh

Mesh generation using distance fields

License

Notifications You must be signed in to change notification settings

kinnala/dfmesh

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dfmesh

A mesh generator inspired by distmesh.

Installation

pip install git+https://github.com/kinnala/dfmesh.git

Examples

Basic usage

import dfmesh as df
geo = df.Circle([0., 0.], 1.)
p, t = df.triangulate(geo, 0.1)  # edge length

Primitives

import dfmesh as df
geo = df.Circle([0., 0.], 1.)
geo = df.Rectangle(-1., 2., -1., 1.)
geo = df.Polygon([[0.0, 0.0],
                  [1.1, 0.0],
                  [1.2, 0.5],
                  [0.7, 0.6],
                  [2.0, 1.0],
                  [1.0, 2.0],
                  [0.5, 1.5]])
geo = df.HalfSpace([1., 1.])  # normal vector (1, 1)

Set operations

import dfmesh as df
geo = df.Circle([-.5, 0.], 1.) - df.Circle([.5, 0.], 1.)
geo = df.Circle([-.5, 0.], 1.) + df.Circle([.5, 0.], 1.)
geo = df.Circle([0., -.5], 1.) & df.Circle([0., .5], 1.)  # intersection

Rotate, translate, scale

import dfmesh as df
geo = df.Rotation(df.Rectangle(-1., 2., -1., 1.), 3.1415 / 4.)
geo = [1., 1.] + df.Rectangle(-1., 2., -1., 1.)
geo = 2. * df.Rectangle(-1., 2., -1., 1.)

Nonuniform elements

import dfmesh as df
geo = df.Rectangle(-1., 2., -1., 1.)
path = df.Path([[.4, .6], [.6, .4]])
p, t = df.triangulate(geo, lambda x: .03 + .1 * path.dist(x))

License

This is a fork of dmsh 0.2.19 and meshplex 0.17.1 (c) Nico Schlömer which are both GPLv3:

The later versions of dmsh use a proprietary license.

About

Mesh generation using distance fields

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%