Main Content

intersect

Intersection of shape1 and shape2

Description

example

intersect(shape1,shape2) plots a shape generated by intersecting theshape1 and shape2. Alternatively, you can also use the '&' operator to intersect the shapes (shape1 & shape2).

example

c = intersect(shape1,shape2) generates the shape obtained by intersecting shape1 and shape2 and returns a polygon object for resultant 2-D shape or a custom 3-D object for resultant 3-D shape. Alternatively, you can also use the '&' operator to intersect the shapes (c = shape1 & shape2).

Examples

collapse all

Create a default rectangle.

r = antenna.Rectangle;

Create a default circle.

c = antenna.Circle;

Use intersect to combine the shared surfaces of the rectangle and the circle.

rc = intersect(r,c)
rc = 
  Polygon with properties:

        Name: 'mypolygon'
    Vertices: [12x3 double]

show(rc)
axis equal

This example shows how to create a custom shape using a 3-D trapezoid and sphere.

Create and view a 3-D trapezoid.

a = shape.Custom3D(Color=[0.9290 0.6940 0.1250]);
show(a)

Create and view a sphere.

b = shape.Sphere(Color=[0.9290 0.6940 0.1250]);
show(b)

Intersect the 3-D trapezoid with the sphere and view the resultant shape.

intersect(a,b);

Input Arguments

collapse all

2-D and 3-D geometric shapes created using shape objects in Custom 2-D and 3-D Antenna.

Example: antenna.Rectangle,antenna.Circle

Example: shape.Custom3D,shape.Sphere

Output Arguments

collapse all

Shape obtained after intersecting two 2-D or 3-D shapes.

Example: antenna.Polygon

Example: shape.Polygon

Example: shape.Custom3D

Version History

Introduced in R2017a