Main Content

intersect

Boolean intersection between 3-D geometries

Since R2025a

    Description

    g3 = intersect(g1,g2) returns the overlapping part of 3-D geometries g1 and g2 as a geometry g3.

    Boolean intersection of a cube and a sphere resulting in a one eighth piece of the sphere.

    example

    Examples

    collapse all

    Find a Boolean intersection of a cylinder and a cuboid.

    Create and plot a hollow cylinder geometry.

    gcyl = multicylinder([3 4],10,Void=[true,false]);
    pdegplot(gcyl,CellLabels="on")

    Figure contains an axes object. The axes object contains 6 objects of type quiver, text, patch, line.

    Create and plot a single cuboid geometry.

    gcube = multicuboid(sqrt(50),sqrt(50),10);
    pdegplot(gcube)

    Figure contains an axes object. The axes object contains 6 objects of type quiver, text, patch, line.

    Convert both geometries to fegeometry objects.

    gcyl = fegeometry(gcyl);
    gcube = fegeometry(gcube);

    Find the intersection of the geometries by using the Boolean intersection operation.

    g = intersect(gcyl,gcube);

    Plot the resulting geometry.

    pdegplot(g,CellLabels="on",FaceAlpha=0.3)

    Figure contains an axes object. The axes object contains 6 objects of type quiver, text, patch, line.

    Input Arguments

    collapse all

    3-D geometry, specified as an fegeometry object.

    3-D geometry, specified as an fegeometry object.

    Output Arguments

    collapse all

    Combined geometry, returned as an fegeometry object.

    Limitations

    • intersect works only on 3-D geometries. Use decsg to intersect 2-D geometries.

    Version History

    Introduced in R2025a

    See Also

    Functions

    Objects