gives the difference of the regions reg1 and reg2.
Details and Options
- A point p belongs to RegionDifference[reg1,reg2] if it belongs to reg1 but not reg2.
- For BoundaryMeshRegion reg1 and reg2, RegionDifference gives the smallest BoundaryMeshRegion that contains the difference of reg1 and reg2.
- For MeshRegion reg1 and reg2, RegionDifference gives the smallest MeshRegion that contains the difference of reg1 and reg2.
- RegionDifference takes the same options as Region.
Examplesopen allclose all
Basic Examples (2)
Difference of two MeshRegion objects:
Special Regions (6)
For some regions, the difference is computed explicitly:
The cuboid is contained in the ball:
A difference of Line regions:
A difference of Polygon regions:
A difference of two Cuboid regions:
A difference of regions with different RegionDimension:
Formula Regions (2)
A difference of ImplicitRegion objects is an ImplicitRegion:
A difference of ParametricRegion objects:
Mesh Regions (2)
A difference of BoundaryMeshRegion objects is a BoundaryMeshRegion:
A difference of full-dimensional MeshRegion objects is a MeshRegion:
Derived Regions (2)
A difference of BooleanRegion objects:
A difference of TransformedRegion objects:
Properties & Relations (5)
A point p belongs to RegionDifference[reg1,reg2] if it belongs to reg1 but not reg2:
Use RegionMember to test membership:
RegionDifference is a Boolean combination ¬#2∧#1 of two regions:
RegionSymmetricDifference can be found using RegionUnion and RegionDifference:
The RegionDimension of a difference is at most that of the first input:
This difference is a line segment, and thus has dimension 1:
If two regions are disjoint, the RegionMeasure of their difference is that of the first input:
If they overlap, you must subtract the measure of the RegionIntersection:
Possible Issues (1)
Difference is defined only for regions with the same RegionEmbeddingDimension:
Wolfram Research (2014), RegionDifference, Wolfram Language function, https://reference.wolfram.com/language/ref/RegionDifference.html (updated 2017).
Wolfram Language. 2014. "RegionDifference." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2017. https://reference.wolfram.com/language/ref/RegionDifference.html.
Wolfram Language. (2014). RegionDifference. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/RegionDifference.html