• Stars
    star
    37
  • Rank 697,545 (Top 15 %)
  • Language
    Julia
  • License
    MIT License
  • Created about 9 years ago
  • Updated 6 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Julia's TetGen wrapper

TetGen

Build status Codecov License: MIT

The TetGen.jl package is a Julia wrapper for the C++ project TetGen. This wrapper enables TetGen based tetrahedral meshing, and (constrained) 3D Delaunay and Voronoi tesselation.

If you find TetGen useful, please consider citing Hang Si: "TetGen, a Delaunay-Based Quality Tetrahedral Mesh Generator" ACM Trans. on Mathematical Software. 41 (2), 2015 http://doi.acm.org/10.1145/2629697.

License

When installing TetGen.jl, a compiled library version of the TetGen library will be downloaded from the TetGen_jll.jl repository. This library is bound to the Affero Gnu Public License v3 (AGPL), but the bindings to the library in this package, TetGen.jl, are licensed under MIT. This means that code using the TetGen library via the TetGen.jl bindings is subject to TetGen's licensing terms. If you distribute covered work, i.e. a program that links to and is distributed with the TetGen library, then that distribution falls under the terms of the AGPLv3.

See the TetGen Licensing FAQ for other options.

Example using GeometryBasics datatypes

using TetGen
using GeometryBasics
using GeometryBasics: Mesh, QuadFace

# Construct a cube out of Quads
points = Point{3, Float64}[
    (0.0, 0.0, 0.0), (2.0, 0.0, 0.0),
    (2.0, 2.0, 0.0), (0.0, 2.0, 0.0),
    (0.0, 0.0, 12.0), (2.0, 0.0, 12.0),
    (2.0, 2.0, 12.0), (0.0, 2.0, 12.0)
]

facets = QuadFace{Cint}[
    1:4,
    5:8,
    [1,5,6,2],
    [2,6,7,3],
    [3, 7, 8, 4],
    [4, 8, 5, 1]
]

markers = Cint[-1, -2, 0, 0, 0, 0]
# attach some additional information to our faces!
mesh = Mesh(points, meta(facets, markers=markers))
result = tetrahedralize(mesh, "vpq1.414a0.1")

using GLMakie

GLMakie.mesh(normal_mesh(result), color=(:blue, 0.1), transparency=true)
GLMakie.wireframe!(result)

Plotted with Makie:

image

Example using plain Julia arrays

using TetGen
let
    tetunsuitable() do pa,pb,pc,pd
        vol=det(hcat(pb-pa,pc-pa,pd-pa))/6
        center=0.25*(pa+pb+pc+pd)-[0.5,0.5,0.5]
        vol> 0.05*norm(center)^2.5
    end

    input=TetGen.RawTetGenIO{Cdouble}()
    input.pointlist=[0 0 0;  
                     1 0 0;
                     1 1 0;
                     0 1 0;
                     0 0 1;  
                     1 0 1;
                     1 1 1;
                     0 1 1]'

    TetGen.facetlist!(input,[1 2 3 4;
                             5 6 7 8;
                             1 2 6 5;
                             2 3 7 6;
                             3 4 8 7;
                             4 1 5 8]')
    tetrahedralize(input, "pQa")
end

Output:

RawTetGenIO(
numberofpoints=169,
numberofedges=27,
numberoftrifaces=112,
numberoftetrahedra=809,
pointlist'=[0.0 1.0 … 0.500059730245037 0.4996534431688176; 0.0 0.0 … 0.5074057466787957 0.49707528530503103; 0.0 0.0 … 0.5033015055704277 0.4953177845338027],
tetrahedronlist'=Int32[34 47 … 15 143; 6 24 … 143 15; 58 52 … 154 150; 70 73 … 168 168],
trifacelist'=Int32[3 58 … 99 22; 19 6 … 22 8; 78 70 … 158 158],
trifacemarkerlist'=Int32[-1, -1, -1, -1, -1, -1, -1, -1, -1, -1  …  -1, -1, -1, -1, -1, -1, -1, -1, -1, -1],
edgelist'=Int32[3 5 … 70 157; 18 24 … 6 32],
edgemarkerlist'=Int32[-1, -1, -1, -1, -1, -1, -1, -1, -1, -1  …  -1, -1, -1, -1, -1, -1, -1, -1, -1, -1],
)

More Repositories

1

Meshes.jl

Computational geometry and meshing algorithms in Julia
Julia
346
star
2

CoordinateTransformations.jl

A fresh approach to coordinate transformations...
Julia
177
star
3

Rotations.jl

Julia implementations for different rotation parameterizations
Julia
171
star
4

GeometryBasics.jl

Basic Geometry Types
Julia
162
star
5

VoronoiDelaunay.jl

Fast and robust Voronoi & Delaunay tessellation creation with Julia
Julia
123
star
6

Quaternions.jl

A Julia implementation of quaternions
Julia
115
star
7

RegionTrees.jl

Quadtrees, Octrees, and more in Julia
Julia
109
star
8

GeometryTypes.jl

Geometry types for Julia
Julia
67
star
9

GeometricalPredicates.jl

Fast and robust 2D & 3D incircle/intriangle/etc. for Julia
Julia
56
star
10

Meshing.jl

Meshing and isosurface extraction algorithms
Julia
55
star
11

MeshViz.jl

Makie.jl recipes for visualization of Meshes.jl
Julia
54
star
12

DelaunayTriangulation.jl

Delaunay triangulations and Voronoi tessellations of planar point sets.
Julia
46
star
13

Descartes.jl

Software Defined Solid Modeling
Julia
43
star
14

Contour.jl

Calculating contour curves for 2D scalar fields in Julia
Julia
39
star
15

Triangulate.jl

Julia Wrapper for the Triangle Mesh Generator
Julia
38
star
16

VoronoiCells.jl

Voronoi tesselations in Julia
Julia
33
star
17

Clipper.jl

Julia wrapping of clipper
Julia
30
star
18

KDTrees.jl

KDTrees for julia
Julia
25
star
19

OldImmutableArrays.jl

Statically-sized immutable vectors and matrices.
Julia
21
star
20

PolygonOps.jl

Generic Polygon Operations
Julia
21
star
21

Delaunator.jl

Delaunator in Julia
Julia
21
star
22

DistMesh.jl

Tetrahedral meshing of distance functions in Julia
Julia
20
star
23

OldMeshes.jl

A collection of tools for working with Meshes
Julia
20
star
24

PlyIO.jl

Read and write polygon ply files from julia
Julia
20
star
25

MarchingCubes.jl

Efficient Implementation of Marching Cubes' Cases with Topological Guarantees
C
19
star
26

TriangleIntersect.jl

Fast ray-triangle intersections for raytracing
Julia
12
star
27

OctTrees.jl

Fast quad and oct-trees for Julia
Julia
12
star
28

RayTraceEllipsoid.jl

Ray trace ellipsoid-shaped domes. Find intersection points and refract/reflect according to the refractive indices.
Julia
11
star
29

Packing.jl

Algorithms for packing problems
Julia
9
star
30

Octonions.jl

A Julia implementation of octonions
Julia
8
star
31

meta

For discussion centered around the JuliaGeometry organization
8
star
32

Bullet3.jl

Wrapper for Bullet3 physics engine
Julia
7
star
33

EarCut.jl

Wrapper for Mapbox's earcut.hpp for polygon triangulation
Julia
6
star
34

tetgen.dependency

tetgen unmodified source and binary for win & linux
C++
5
star
35

MeshPlots.jl

Plots.jl recipes for Meshes.jl
Julia
2
star
36

Intervals.jl

Interval arithmetic and algebra in Julia (not maintained, or ever published)
Julia
1
star
37

TriangleBuilder

Julia
1
star
38

TetgenBuilder

binaries for Tetgen
Julia
1
star
39

juliageometry.github.io

The juliageometry.org website
HTML
1
star
40

QuadricMeshSimplification.jl

Quadric Mesh Simplification for reducing triangle counts
Julia
1
star
41

Libfive.jl

Wrapper for the Libfive library for generative design
Julia
1
star