({{, (RefLink[RegionSymmetricDifference, paclet:ref/RegionSymmetricDifference])[(Subscript[reg, 1]),(Subscript[reg, 2]),…] 
represents the symmetric difference of the regions (Subscript[reg, 1]), (Subscript[reg, 2]), ….}})

OpenersNotesSection(Spacer1)Details and Options

A point p belongs to (RefLink[RegionSymmetricDifference, paclet:ref/RegionSymmetricDifference])[(Subscript[reg, 1]),(Subscript[reg, 2]),…] if it belongs to an odd number of (Subscript[reg, i]).

For (RefLink[BoundaryMeshRegion, paclet:ref/BoundaryMeshRegion]) (Subscript[reg, 1]) and (Subscript[reg, 2]), (RefLink[RegionSymmetricDifference, paclet:ref/RegionSymmetricDifference]) gives the smallest (RefLink[BoundaryMeshRegion, paclet:ref/BoundaryMeshRegion]) that contains the difference of (Subscript[reg, 1]) and (Subscript[reg, 2]).

For (RefLink[MeshRegion, paclet:ref/MeshRegion]) (Subscript[reg, 1]) and (Subscript[reg, 2]), (RefLink[RegionSymmetricDifference, paclet:ref/RegionSymmetricDifference]) gives the smallest (RefLink[MeshRegion, paclet:ref/MeshRegion]) that contains the difference of (Subscript[reg, 1]) and (Subscript[reg, 2]).

(RefLink[RegionSymmetricDifference, paclet:ref/RegionSymmetricDifference]) takes the same options as (RefLink[Region, paclet:ref/Region]).

OpenersPrimaryExamplesSection(Spacer1)Examples  (20)

OpenersExampleSection0(Spacer1)Basic Examples  (2)

Symmetric difference of two disks:

RegionSymmetricDifference[Disk[{0,0},2],Disk[{3,0},2]];

Visualize it:

Region[%]

Symmetric difference of two (RefLink[MeshRegion, paclet:ref/MeshRegion]) objects:

RegionSymmetricDifference[,]

OpenersExampleSection1(Spacer1)Scope  (10)

OpenersExampleSubsection0(Spacer1)Special Regions  (4)

A symmetric difference of (RefLink[Line, paclet:ref/Line]) regions:

ℛ=RegionSymmetricDifference[Line[{{1},{3}}],Line[{{2},{4}}]];

Visualize it:

Region[ℛ]

A symmetric difference of (RefLink[Polygon, paclet:ref/Polygon]) regions:

(Subscript[ℛ, 1])=Polygon[{{0,0},{3,-1},{2,0},{3,1}}];
(Subscript[ℛ, 2])=Polygon[{{5,0},{2,1},{3,0},{2,-1}}];

ℛ=RegionSymmetricDifference[(Subscript[ℛ, 1]),(Subscript[ℛ, 2])];

Visualize it:

Region[ℛ]

A symmetric difference of two (RefLink[Cuboid, paclet:ref/Cuboid]) regions:

ℛ=RegionSymmetricDifference[Cuboid[],Cuboid[{0.5,0.5,0.5}]];

Region[ℛ]

A symmetric difference of regions with different (RefLink[RegionDimension, paclet:ref/RegionDimension]):

ℛ=RegionSymmetricDifference[Circle[{0,0},1],Disk[{1,0},1]];

Visualize it:

Region[ℛ]

OpenersExampleSubsection1(Spacer1)Formula Regions  (2)

A symmetric difference of (RefLink[ImplicitRegion, paclet:ref/ImplicitRegion]) objects is an (RefLink[ImplicitRegion, paclet:ref/ImplicitRegion]):

(Subscript[ℛ, 1])=ImplicitRegion[x≤-1,{x}];
(Subscript[ℛ, 2])=ImplicitRegion[x≥1,{x}];

RegionSymmetricDifference[(Subscript[ℛ, 1]),(Subscript[ℛ, 2])]

2D:

(Subscript[ℛ, 1])=ImplicitRegion[(x^2)+(y^2)≤1,{x,y}];
(Subscript[ℛ, 2])=ImplicitRegion[(x^2)+(((y-1))^2)≤1,{x,y}];
RegionSymmetricDifference[(Subscript[ℛ, 1]),(Subscript[ℛ, 2])]

3D:

(Subscript[ℛ, 1])=ImplicitRegion[(x^2)+(y^2)+(z^2)≤1,{x,y,z}];
(Subscript[ℛ, 2])=ImplicitRegion[(((x-1))^2)+(y^2)+(z^2)≤1,{x,y,z}];

RegionSymmetricDifference[(Subscript[ℛ, 1]),(Subscript[ℛ, 2])]

nD:

(Subscript[ℛ, 1])=ImplicitRegion[(x^2)+(y^2)+(z^2)+(u^2)+(v^2)≤1,{x,y,z,u,v}];
(Subscript[ℛ, 2])=ImplicitRegion[(((x-1))^2)+(y^2)+(z^2)+(u^2)+(v^2)≤1,{x,y,z,u,v}];

RegionSymmetricDifference[(Subscript[ℛ, 1]),(Subscript[ℛ, 2])]

A symmetric difference of (RefLink[ParametricRegion, paclet:ref/ParametricRegion]) objects:

(Subscript[ℛ, 1])=ParametricRegion[{u,v},{{u,0,2},{v,0,2}}];
(Subscript[ℛ, 2])=ParametricRegion[{u+1,v+1},{{u,0,2},{v,0,2}}];

ℛ=RegionSymmetricDifference[(Subscript[ℛ, 1]),(Subscript[ℛ, 2])];

Visualize it:

Region[ℛ]

OpenersExampleSubsection2(Spacer1)Mesh Regions  (2)

A symmetric difference of (RefLink[BoundaryMeshRegion, paclet:ref/BoundaryMeshRegion]) objects is a (RefLink[BoundaryMeshRegion, paclet:ref/BoundaryMeshRegion]):

RegionSymmetricDifference[,]

BoundedRegionQ[%]

2D:

RegionSymmetricDifference[,]

BoundedRegionQ[%]

3D:

RegionSymmetricDifference[,]

BoundedRegionQ[%]

A symmetric difference of full-dimensional (RefLink[MeshRegion, paclet:ref/MeshRegion]) objects is a (RefLink[MeshRegion, paclet:ref/MeshRegion]):

RegionSymmetricDifference[,]

MeshRegionQ[%]

2D:

RegionSymmetricDifference[,]

MeshRegionQ[%]

3D:

RegionSymmetricDifference[,]

MeshRegionQ[%]

OpenersExampleSubsection3(Spacer1)Derived Regions  (2)

A symmetric difference of (RefLink[BooleanRegion, paclet:ref/BooleanRegion]) objects:

(Subscript[ℛ, 1])= BooleanRegion[Or,{Triangle[{{0,0},{2,3},{-2,3}}],Triangle[{{0,2},{2,-1},{-2,-1}}]}];
(Subscript[ℛ, 2]) = BooleanRegion[And,{Triangle[{{0,0},{2,3},{-2,3}}],Triangle[{{0,2},{2,-1},{-2,2}}]}];

ℛ=RegionSymmetricDifference[(Subscript[ℛ, 1]),(Subscript[ℛ, 2])];

Visualize it:

Region[ℛ]

A symmetric difference of (RefLink[TransformedRegion, paclet:ref/TransformedRegion]) objects:

(Subscript[ℛ, 1])=TransformedRegion[Cuboid[],RotationTransform[Pi/8,{1,0,0}]];
(Subscript[ℛ, 2])=TransformedRegion[Cuboid[],RotationTransform[Pi/8,{0,1,0}]];

ℛ=RegionSymmetricDifference[(Subscript[ℛ, 1]),(Subscript[ℛ, 2])];

Visualize it:

Region[ℛ]

OpenersExampleSection3(Spacer1)Applications  (1)

Symmetric difference of regions:

{(Subscript[ℛ, 1]),(Subscript[ℛ, 2])}={,};

Multicolumn[Table[RegionSymmetricDifference[(Subscript[ℛ, 1]),TransformedRegion[(Subscript[ℛ, 2]),TranslationTransform[{t,t}]]],{t,-0.5,2,0.5}],3,Appearance->"Horizontal"]

OpenersExampleSection4(Spacer1)Properties & Relations  (5)

A point p belongs to (RefLink[RegionSymmetricDifference, paclet:ref/RegionSymmetricDifference])[(Subscript[reg, 1]),(Subscript[reg, 2])] if it belongs to an odd number of (Subscript[reg, i]):

(Subscript[ℛ, 1])=Disk[{0,0},2];
(Subscript[ℛ, 2])=Disk[{0,3},2];
(Subscript[ℛ, 3])=RegionSymmetricDifference[(Subscript[ℛ, 1]),(Subscript[ℛ, 2])];

Use (RefLink[RegionMember, paclet:ref/RegionMember]) to test membership:

p={0,0};

RegionMember[(Subscript[ℛ, 3]), p] == (RegionMember[(Subscript[ℛ, 1]),p] ∧!RegionMember[(Subscript[ℛ, 2]), p])∨(!RegionMember[(Subscript[ℛ, 1]),p] ∧RegionMember[(Subscript[ℛ, 2]), p])

(RefLink[RegionSymmetricDifference, paclet:ref/RegionSymmetricDifference]) is a Boolean combination (RefLink[Xor, paclet:ref/Xor]) of regions:

{(Subscript[ℛ, 1]),(Subscript[ℛ, 2])} = {,};

RegionSymmetricDifference[(Subscript[ℛ, 1]),(Subscript[ℛ, 2])]==BooleanRegion[Xor,{(Subscript[ℛ, 1]),(Subscript[ℛ, 2])}]

(RefLink[RegionSymmetricDifference, paclet:ref/RegionSymmetricDifference]) can be found using (RefLink[RegionUnion, paclet:ref/RegionUnion]) and (RefLink[RegionDifference, paclet:ref/RegionDifference]):

{(Subscript[ℛ, 1]),(Subscript[ℛ, 2])} = {,};

RegionSymmetricDifference[(Subscript[ℛ, 1]),(Subscript[ℛ, 2])]== RegionUnion[RegionDifference[(Subscript[ℛ, 1]),(Subscript[ℛ, 2])],RegionDifference[(Subscript[ℛ, 2]),(Subscript[ℛ, 1])]]

The (RefLink[RegionDimension, paclet:ref/RegionDimension]) of a symmetric difference is at most the max of the input dimensions:

(Subscript[ℛ, 1])=Disk[{0,0},1];
(Subscript[ℛ, 2])=Disk[{1,0},1];
(Subscript[ℛ, 3])=RegionSymmetricDifference[(Subscript[ℛ, 1]),(Subscript[ℛ, 2])];

RegionDimension[(Subscript[ℛ, 3])]==Max[RegionDimension/@{(Subscript[ℛ, 1]),(Subscript[ℛ, 2])}]

It can be less, however:

(Subscript[ℛ, 1])=InfiniteLine[{0,0},{1,0}];
(Subscript[ℛ, 2])=InfiniteLine[{0,1},{1,0}];
ℛ=RegionSymmetricDifference[(Subscript[ℛ, 1]),(Subscript[ℛ, 2])];

This symmetric difference is two lines, and thus has dimension 1:

RegionDimension[ℛ]

The (RefLink[RegionMeasure, paclet:ref/RegionMeasure]) of a symmetric difference obeys a simple formula:

(Subscript[ℛ, 1])=Disk[{0,0},1];
(Subscript[ℛ, 2])=Disk[{1,0},1];
(Subscript[ℛ, 3])=RegionSymmetricDifference[(Subscript[ℛ, 1]),(Subscript[ℛ, 2])];

Simply subtract twice the measure of the intersection from the sum of the input measures:

RegionMeasure[(Subscript[ℛ, 3])]==RegionMeasure[(Subscript[ℛ, 1])]+RegionMeasure[(Subscript[ℛ, 2])]-2RegionMeasure[RegionIntersection[(Subscript[ℛ, 1]),(Subscript[ℛ, 2])]]

OpenersExampleSection5(Spacer1)Possible Issues  (1)

Symmetric difference is defined only for regions with the same (RefLink[RegionEmbeddingDimension, paclet:ref/RegionEmbeddingDimension]):

(Subscript[ℛ, 1])=Disk[];
(Subscript[ℛ, 2])=Ball[{0,0,1},1];

RegionSymmetricDifference[(Subscript[ℛ, 1]),(Subscript[ℛ, 2])]

OpenersExampleSection6(Spacer1)Neat Examples  (1)

The symmetric difference of two spiral polygons:

RegionSymmetricDifference[,]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[RegionDifference, paclet:ref/RegionDifference])  ▪  (RefLink[RegionUnion, paclet:ref/RegionUnion])  ▪  (RefLink[RegionIntersection, paclet:ref/RegionIntersection])  ▪  (RefLink[BooleanRegion, paclet:ref/BooleanRegion])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Derived Geometric Regions, paclet:guide/DerivedRegions])}})}})