|
3 | 3 | [](https://travis-ci.org/JuliaGeometry/Meshing.jl)
|
4 | 4 | [](http://codecov.io/github/JuliaGeometry/Meshing.jl?branch=master)
|
5 | 5 |
|
6 |
| -This package provides meshing algorithms for use on distance fields. |
| 6 | +This package provides a comprehensive suite of meshing algorithms for use on distance fields. |
7 | 7 |
|
8 |
| -Including: |
| 8 | +Algorithms included: |
9 | 9 | * [Marching Tetrahedra](https://en.wikipedia.org/wiki/Marching_tetrahedra)
|
10 | 10 | * [Marching Cubes](https://en.wikipedia.org/wiki/Marching_cubes)
|
11 | 11 | * [Naive Surface Nets](https://0fps.net/2012/07/12/smooth-voxel-terrain-part-2/)
|
12 | 12 |
|
13 | 13 | ## Interface
|
14 | 14 |
|
15 |
| -This package is tightly integrated with [GeometryTypes.jl](https://github.com/JuliaGeometry/GeometryTypes.jl). |
| 15 | +This package inherits the [mesh types](http://juliageometry.github.io/GeometryTypes.jl/latest/types.html#Meshes-1) |
| 16 | +from [GeometryTypes.jl](https://github.com/JuliaGeometry/GeometryTypes.jl). |
16 | 17 |
|
17 |
| -All algorithms operate on `SignedDistanceField` and output a concrete `AbstractMesh`. For example: |
| 18 | +The algorithms operate on a `Function` or a `SignedDistanceField` and output a concrete `AbstractMesh`. For example: |
18 | 19 |
|
19 | 20 | ```
|
20 | 21 | using Meshing
|
21 | 22 | using GeometryTypes
|
22 | 23 | using LinearAlgebra: dot, norm
|
23 | 24 | using FileIO
|
24 | 25 |
|
25 |
| -# generate an SDF of a sphere |
26 |
| -sdf_sphere = SignedDistanceField(HyperRectangle(Vec(-1,-1,-1.),Vec(2,2,2.))) do v |
27 |
| - sqrt(sum(dot(v,v))) - 1 # sphere |
| 26 | +# Mesh an equation of sphere in the Axis-Aligned Bounding box starting |
| 27 | +# at -1,-1,-1 and widths of 2,2,2 |
| 28 | +m = GLNormalMesh(HyperRectangle(Vec(-1,-1,-1.), Vec(2,2,2.)), MarchingCubes()) do v |
| 29 | + sqrt(sum(dot(v,v))) - 1 |
28 | 30 | end
|
29 | 31 |
|
30 |
| -m = GLNormalMesh(sdf_sphere, MarchingCubes()) |
31 |
| -
|
| 32 | +# save the Sphere as a PLY file |
32 | 33 | save("sphere.ply",m)
|
33 | 34 | ```
|
34 | 35 |
|
35 |
| -The general API is ``(::Type{MT})(sdf::SignedDistanceField, method::AbstractMeshingAlgorithm) where {MT <: AbstractMesh}`` |
| 36 | +The general API is: ```(::Type{MT})(sdf::Function, method::AbstractMeshingAlgorithm) where {MT <: AbstractMesh}``` or ```(::Type{MT})(sdf::SignedDistanceField, method::AbstractMeshingAlgorithm) where {MT <: AbstractMesh}``` |
| 37 | + |
36 | 38 |
|
37 | 39 | For a full listing of concrete `AbstractMesh` types see [GeometryTypes.jl mesh documentation](http://juliageometry.github.io/GeometryTypes.jl/latest/types.html#Meshes-1).
|
38 | 40 |
|
|
0 commit comments