Main Content

hull

R2026b

Find convex hull of combined geometries

Since R2026b

    Description

    g = hull(gv) creates a geometry as a convex hull enclosing all the geometries specified in gv.

    All geometries in gv must be either 2-D or 3-D. The function does not support a mix of 2-D and 3-D geometries.

    example

    Examples

    collapse all

    Create and plot two geometries representing unit spheres.

    g1 = fegeometry(multisphere(1));
    g2 = translate(g1,[3 0 0]);
    pdegplot(g1)
    hold on
    pdegplot(g2)
    hold off

    Two unit spheres separated along x-axis by distance 3

    Find a convex hull enclosing the spheres.

    g = hull([g1 g2]);
    figure
    pdegplot(g)

    Convex hull enclosing two spheres, capsule shape

    Import and plot a geometry containing four cells.

    gm = fegeometry("DampingMounts.stl");
    pdegplot(gm,CellLabels="on")

    Damping mounts geometry with cell labels C1 through C4

    Find a convex hull enclosing the geometry. The resulting geometry has one cell.

    g = hull(gm);
    pdegplot(g,CellLabels="on")

    Convex hull of damping mounts geometry, single rounded plate with cell label C1

    Create and plot two 2-D geometries.

    g1 = fegeometry(@cirsg);
    g2 = translate(rotate(g1,180),[2 0]);
    pdegplot(g1)
    hold on
    pdegplot(g2)
    hold off

    Two 2D geometries with notched circles centered at x=0 and x=2

    Find a convex hull enclosing the geometries.

    g = hull([g1 g2]);
    figure
    pdegplot(g)

    Convex hull enclosing the two geometries, rounded rectangle shape

    Input Arguments

    collapse all

    Input geometries, specified as a vector of fegeometry objects.

    Output Arguments

    collapse all

    Resulting geometry, returned as an fegeometry object. If the resulting geometry is 3-D, it has one cell. If the resulting geometry is 2-D, it has one face.

    Version History

    Introduced in R2026b