main content

fill void regions in 2-凯发k8网页登录

fill void regions in 2-d and split cells in 3-d geometry

since r2020a

description

example

h = addface(g,edges) adds a new face to the geometry g. the specified edges must form a closed contour. for a 2-d geometry, adding a new face lets you fill voids in the geometry. for a 3-d geometry, adding a new face lets you split one cell into multiple cells.

you can add several new faces simultaneously by specifying their contours in a cell array. each contour in the cell array must be unique.

note

after modifying a geometry, always call generatemesh to ensure a proper mesh association with the new geometry.

example

[h,faceid] = addface(g,edges) also returns a row vector containing ids of the added faces.

examples

add a face to a 2-d geometry to fill an internal void.

create a pde model.

model = createpde();

import the geometry. this geometry has one face.

gm = importgeometry(model,"platesquareholeplanar.stl")
gm = 
  discretegeometry with properties:
       numcells: 0
       numfaces: 1
       numedges: 8
    numvertices: 8
       vertices: [8x3 double]

plot the geometry and display the face labels.

pdegplot(gm,"facelabels","on")

figure contains an axes object. the axes object contains an object of type line.

zoom in and display the edge labels of the small hole at the center.

figure
pdegplot(gm,"edgelabels","on")
axis([49 51 99 101])

figure contains an axes object. the axes object contains an object of type line.

fill the hole by adding a face. the number of faces in the geometry changes to 2.

gm = addface(gm,[1 8 4 5])
gm = 
  discretegeometry with properties:
       numcells: 0
       numfaces: 2
       numedges: 8
    numvertices: 8
       vertices: [8x3 double]

plot the modified geometry and display the face labels.

pdegplot(gm,"facelabels","on")

figure contains an axes object. the axes object contains an object of type line.

add a face in a 3-d geometry to split a cell into two cells.

create a pde model.

model = createpde();

import the geometry. the geometry consists of one cell.

gm = importgeometry(model,"motherboardfragment1.stl")
gm = 
  discretegeometry with properties:
       numcells: 1
       numfaces: 26
       numedges: 46
    numvertices: 34
       vertices: [34x3 double]

plot the geometry and display the edge labels. zoom in on the corresponding part of the geometry to see the edge labels there more clearly.

pdegplot(gm,"edgelabels","on","facealpha",0.5)
xlim([-0.05 0.05])
ylim([-0.05 0.05])
zlim([0 0.05])

figure contains an axes object. the axes object contains 3 objects of type quiver, patch, line.

split the cuboid on the right side into a separate cell. for this, add a face bounded by edges 1, 3, 6, and 12.

[gm,id] = addface(gm,[1 3 6 12])
gm = 
  discretegeometry with properties:
       numcells: 2
       numfaces: 27
       numedges: 46
    numvertices: 34
       vertices: [34x3 double]
id = 27

plot the modified geometry and display the cell labels.

pdegplot(gm,"celllabels","on","facealpha",0.5)

figure contains an axes object. the axes object contains 3 objects of type quiver, patch, line.

now split the cuboid on the left side of the board and all cylinders into separate cells by adding a face at the bottom of each shape. to see edge labels more clearly, zoom and rotate the plot. use a cell array to add several new faces simultaneously.

[gm,ids] = addface(gm,{[5 7 8 10], ...
                        30, ...
                        31, ...
                        32, ...
                        33, ...
                        13})
gm = 
  discretegeometry with properties:
       numcells: 8
       numfaces: 33
       numedges: 46
    numvertices: 34
       vertices: [34x3 double]
ids = 6×1
    28
    29
    30
    31
    32
    33

plot the modified geometry and display the cell labels.

pdegplot(gm,"celllabels","on","facealpha",0.5)

figure contains an axes object. the axes object contains 3 objects of type quiver, patch, line.

input arguments

geometry, specified as an fegeometry object, a discretegeometry, or an analyticgeometry object. see , , and .

edges forming a unique closed flat contour, specified as a vector of positive integers or a cell array of such vectors. you can specify edges within a vector in any order.

when you use a cell array to add several new faces, each contour in the cell array must be unique.

example: addface(g,[1 3 4 7])

output arguments

  • if the original geometry g is an fegeometry object, then h is a new fegeometry object representing the modified geometry. the original geometry g remains unchanged.

  • if the original geometry g is a discretegeometry analyticgeometry object, then h is a handle to the modified object g.

face id, returned as a positive number or a row vector of positive numbers. each number represents a face id. when you add a new face to a geometry with n faces, the id of the added face is n 1.

tips

  • addface errors when the specified contour defines an already existing face.

  • if the original geometry g is a discretegeometry or analyticgeometry object, addface modifies the original geometry g.

  • if the original geometry g is an fegeometry object, and you want to replace it with the modified geometry, assign the output to the original geometry, for example, g = addface(g,[1 3 4 7]).

version history

introduced in r2020a

see also

functions

objects

properties

  • |
网站地图