gf_slice — Mesh slice creation.
sl = gf_slice(sliceop, mesh M, int REFINE [, CVFLST])
sl = gf_slice(sliceop, mesh_fem MF, vec U, int REFINE [, CVFLST])
sl = gf_slice(sliceop, slice SL)
sl = gf_slice('streamlines', mesh_fem MF, vec U, mat SEEDS)
sl = gf_slice('points', mesh M, mat PTS)
Creation of a mesh slice. Mesh slices are very similar to a P1-discontinuous mesh_fem on which interpolation is very fast. The slice is built from a mesh object, and a description of the slicing operation, for example,
sl = gf_slice(list('planar',+1,[0;0],[1;0]), m, 5);
cuts the original mesh with the half space [y>0]. Each convex of the original mesh m is simplexified (for example a quadrangle is splitted into 2 triangles), and each simplex is refined 5 times.
Slicing operations can be:
cutting with a plane, a sphere or a cylinder
intersection or union of slices
isovalues surfaces/volumes
"points", "streamlines" (see below)
If the first argument is a mesh_fem mf instead of a mesh, and if it
is followed by a field U (with size(U,1) ==
gf_mesh_fem_get(mf,U)), then the deformation
U will be applied to the mesh before the slicing
operation.
The first argument can also be a slice.
Slicing operations:
Always specifiy them between braces (i.e. in a cell array). The first argument is the name of the operation, followed the slicing options.
list('none'): Does not cut the mesh.
list('planar', orient, p, n): Planar cut. p
and n define a half-space, p
being a point belong to the boundary of the half-space, and n being
its normal. If orient is equal to -1 (resp. 0, +1),
then the slicing operation will cut the mesh with the "interior"
(resp. "boundary", "exterior") of the half-space.
Orient may also be set to +2 which means that the
mesh will be sliced, but both the outer and inner parts will be
kept.
list('ball', orient, c, r): Cut with a ball of center
c and radius r.
list('cylinder', orient, p1, p2, r): Cut with a cylinder whose axis is the line (p1,p2) and whose radius is r.
list('isovalues',orient, mesh_fem MF, vec U, scalar V): Cut
using the isosurface of the field U (defined on the
mesh_fem MF). The result is the set {x
such that U(x) <= V} or {x such that U(x) == V} or {x such that
U(x) <= V} depending on the value of
ORIENT.
list('boundary'[, SLICEOP]): Return the boundary of the result
of SLICEOP, where SLICEOP is any
slicing operation. If SLICEOP is not specified,
then the whole mesh is considered (i.e. it is equivalent to
list('boundary',list('none'))).
list('explode', coef): Build an 'exploded' view of the mesh: each convex is shrinked (0 <coef <= 1). In the case of 3D convexes, only their faces are kept.
list('union', SLICEOP1, SLICEOP2),
list('intersection', SLICEOP1, SLICEOP2),
list('comp', SLICEOP),
list('diff', SLICEOP1, SLICEOP2): Boolean operations: returns the union,intersection,complementary or difference of slicing operations.
list('mesh', MESH): Build a slice which is the intersection of the sliced mesh with another mesh. The slice is such that all of its simplexes are stricly contained into a convex of each mesh.
SPECIAL SLICES:
There are also some special calls to gf_slice:
gf_slice('streamlines',mf, U, mat SEEDS): compute streamlines of
the (vector) field U, with seed points given by the
columns of SEEDS.
gf_slice('points', m, mat PTS): return the "slice" composed of
points given by the columns of PTS (useful for
interpolation on a given set of sparse points, see
gf_compute(mf,U,'interpolate on',sl).
gf_slice('load', filename [,m]): load the slice (and its linked_mesh if it is not given as an argument) from a text file.
Apply the deformation given by mf,U on the mesh, then slice it with the z+ half-space, and keep only the part where U2(x) > 0.
sl = gf_slice(list(intersection',list('planar',+1,[0;0;0],[0;0;1]),list('isovalues',-1,mf2,U2,0)),mf,U,5);
view the convex quality of a 2D or 3D mesh m:
gf_plot_slice(gf_slice(list('explode', 0.7), m, 2), 'convex_data', gf_mesh_get(m,'quality'));
See the gf_plot_slice usage example for more slices.