Intersection of shape1 and shape2
intersect( plots a shape
generated by intersecting the
shape2. Alternatively, you can also use the
'&' operator to intersect the shapes (
Intersect Rectangle and Circle
Create a default rectangle.
r = antenna.Rectangle;
Create a default circle.
c = antenna.Circle;
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
Create Custom Shape by Intersecting Shapes
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.
c — Resultant shape
Shape obtained after intersecting two 2-D or 3-D shapes.
Introduced in R2017a