Refinement
Meshes.refine
— Functionrefine(mesh, method)
Refine mesh
with refinement method
.
Meshes.RefinementMethod
— TypeRefinementMethod
A method for refining meshes.
TriRefinement
Meshes.TriRefinement
— TypeTriRefinement([pred])
Refinement of polygonal meshes into triangles. A n-gon for which the predicate pred
holds true is subdivided into n triangles. The method refines all n-gons if the pred
is ommited.
grid = CartesianGrid(10, 10)
# refine three times
ref1 = refine(grid, TriRefinement())
ref2 = refine(ref1, TriRefinement())
ref3 = refine(ref2, TriRefinement())
fig = Mke.Figure(size = (800, 800))
viz(fig[1,1], grid, showsegments = true)
viz(fig[1,2], ref1, showsegments = true)
viz(fig[2,1], ref2, showsegments = true)
viz(fig[2,2], ref3, showsegments = true)
fig
QuadRefinement
Meshes.QuadRefinement
— TypeQuadRefinement()
Refinement of polygonal meshes into quadrangles. A n-gon is subdivided into n quadrangles.
grid = CartesianGrid(10, 10)
# refine three times
ref1 = refine(grid, QuadRefinement())
ref2 = refine(ref1, QuadRefinement())
ref3 = refine(ref2, QuadRefinement())
fig = Mke.Figure(size = (800, 800))
viz(fig[1,1], grid, showsegments = true)
viz(fig[1,2], ref1, showsegments = true)
viz(fig[2,1], ref2, showsegments = true)
viz(fig[2,2], ref3, showsegments = true)
fig
RegularRefinement
Meshes.RegularRefinement
— TypeRegularRefinement(f₁, f₂, ..., fₙ)
Refine each dimension of the grid by given factors f₁
, f₂
, ..., fₙ
.
Examples
refine(grid2D, RegularRefinement(2, 3))
refine(grid3D, RegularRefinement(2, 3, 1))
grid = CartesianGrid(10, 10)
# refine three times
ref1 = refine(grid, RegularRefinement(2, 2))
ref2 = refine(ref1, RegularRefinement(3, 2))
ref3 = refine(ref2, RegularRefinement(2, 3))
fig = Mke.Figure(size = (800, 800))
viz(fig[1,1], grid, showsegments = true)
viz(fig[1,2], ref1, showsegments = true)
viz(fig[2,1], ref2, showsegments = true)
viz(fig[2,2], ref3, showsegments = true)
fig
Catmull-Clark
Meshes.CatmullClarkRefinement
— TypeCatmullClarkRefinement()
Catmull-Clark refinement of polygonal meshes.
Strictly speaking, the Catmull-Clark algorithm is used for subdivision surface modeling, not just mesh refinement. At each step of refinement, the vertices are adjusted to approximate a smooth surface.
References
- Catmull & Clark. 1978. Recursively generated B-spline surfaces on arbitrary topological meshes
# define a cube in R^3
points = [(0,0,0),(1,0,0),(1,1,0),(0,1,0),(0,0,1),(1,0,1),(1,1,1),(0,1,1)]
connec = connect.([(1,4,3,2),(5,6,7,8),(1,2,6,5),(3,4,8,7),(1,5,8,4),(2,3,7,6)])
mesh = SimpleMesh(points, connec)
# refine three times
ref1 = refine(mesh, CatmullClarkRefinement())
ref2 = refine(ref1, CatmullClarkRefinement())
ref3 = refine(ref2, CatmullClarkRefinement())
fig = Mke.Figure(size = (800, 800))
viz(fig[1,1], mesh, showsegments = true)
viz(fig[1,2], ref1, showsegments = true)
viz(fig[2,1], ref2, showsegments = true)
viz(fig[2,2], ref3, showsegments = true)
fig
TriSubdivision
Meshes.TriSubdivision
— TypeTriSubdivision()
Refinement of a mesh by preliminarly triangulating it if needed and then subdividing each triangle into four triangles.
References
- Charles Loop. 1987. Smooth subdivision surfaces based on triangles. Master's thesis, University of Utah.
grid = CartesianGrid(10, 10)
# refine three times
ref1 = refine(grid, TriSubdivision())
ref2 = refine(ref1, TriSubdivision())
ref3 = refine(ref2, TriSubdivision())
fig = Mke.Figure(size = (800, 800))
viz(fig[1,1], grid, showsegments = true)
viz(fig[1,2], ref1, showsegments = true)
viz(fig[2,1], ref2, showsegments = true)
viz(fig[2,2], ref3, showsegments = true)
fig