Документация Engee

Refinement

Страница в процессе перевода.

refine(mesh, method)

Refine mesh with refinement method.

RefinementMethod

A method for refining meshes.

TriRefinement

TriRefinement([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
bbTl8AAAAASUVORK5CYII=

QuadRefinement

QuadRefinement()

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
JT7FWi8SOqgAAAABJRU5ErkJggg==

RegularRefinement

RegularRefinement(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
D3THmG4eruD+AAAAAElFTkSuQmCC

Catmull-Clark

CatmullClarkRefinement()

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

# 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
gcKgUEnYAEAAAAQTYoGAAAAIJqABQAAAEA0AQsAAACAaAIWAAAAANEELAAAAACiCVgAAAAARBOwAAAAAIgmYAEAAAAQTcACAAAAIJqABQAAAEA0AQsAAACAaAIWAAAAANEELAAAAACiCVgAAAAARBOwAAAAAIgmYAEAAAAQTcACAAAAIJqABQAAAEA0AQsAAACAaAIWAAAAANEELAAAAACiCVgAAAAARBOwAAAAAIgmYAEAAAAQTcACAAAAIJqABQAAAEA0AQsAAACAaAIWAAAAANEELAAAAACiCVgAAAAARBOwAAAAAIgmYAEAAAAQTcACAAAAIJqABQAAAEA0AQsAAACAaAIWAAAAANEELAAAAACiCVgAAAAARBOwAAAAAIgmYAEAAAAQTcACAAAAIJqABQAAAEA0AQsAAACAaAIWAAAAANEELAAAAACiCVgAAAAARBOwAAAAAIgmYAEAAAAQTcACAAAAIJqABQAAAEA0AQsAAACAaAIWAAAAANEELAAAAACiCVgAAAAARBOwAAAAAIgmYAEAAAAQTcACAAAAIJqABQAAAEA0AQsAAACAaAIWAAAAANEELAAAAACiCVgAAAAARBOwAAAAAIgmYAEAAAAQTcACAAAAIJqABQAAAEA0AQsAAACAaAIWAAAAANEELAAAAACiCVgAAAAARBOwAAAAAIgmYAEAAAAQTcACAAAAIJqABQAAAEA0AQsAAACAaAIWAAAAANEELAAAAACiCVgAAAAARBOwAAAAAIgmYAEAAAAQTcACAAAAIJqABQAAAEA0AQsAAACAaAIWAAAAANEELAAAAACiCVgAAAAARBOwAAAAAIgmYAEAAAAQTcACAAAAIJqABQAAAEA0AQsAAACAaAIWAAAAANEELAAAAACiCVgAAAAARBOwAAAAAIgmYAEAAAAQTcACAAAAIJqABQAAAEA0AQsAAACAaAIWAAAAANEELAAAAACiCVgAAAAARBOwAAAAAIgmYAEAAAAQTcACAAAAIJqABQAAAEA0AQsAAACAaAIWAAAAANEELAAAAACiCVgAAAAARBOwAAAAAIgmYAEAAAAQTcACAAAAIJqABQAAAEA0AQsAAACAaH8B7dmHOPQCk+4AAAAASUVORK5CYII=

TriSubdivision

TriSubdivision()

Refinement of a mesh by preliminarly triangulating it if needed and then subdividing each triangle into four triangles.

References

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
vzSZaYGEf7gAAAABJRU5ErkJggg==