# How can I subtract one surface from another?

I have one surface for which I have an analytical solution, and another represented by a list of 3D points. My question is: how can I plot the part of one that lies outside the other?

The first surface:

R = 1;
Ω = Disk[{0, 0}, {R, R}];
θ = 1;
G = 1;
Φ = 1/2 G θ R^2 (1 - x^2/R^2 - y^2/R^2);
Plot3D[Φ, {x, y} ∈ Ω,
PlotStyle -> None,
PlotTheme -> "Detailed", Mesh -> {25},
AxesLabel -> {"x", "y", "ϕ(x,y)"},
LabelStyle -> Directive[FontFamily -> "Courier New"]]


The second surface:

circle =
{{(2 - Sqrt[3])/2, 0.5, 0}, {0, 1, 0},
{(2 - Sqrt[3])/2, 1.5, 0}, {0.5, (2 - Sqrt[3])/2, 0},
{0.5, 0.5, 0.3774047358083551}, {0.5, 1, 0.4599364905389034},
{0.5, 1.5, 0.3774047358083551}, {0.5, (2 + Sqrt[3])/2, 0},
{1, 0., 0}, {1, 0.5, 0.4599364905389034},
{1, 1, 0.5849364905389033}, {1, 1.5, 0.4599364905389034},
{1, 2, 0}, {1.5, (2 - Sqrt[3])/2, 0},
{1.5, 0.5, 0.3774047358083551}, {1.5, 1, 0.4599364905389034},
{1.5, 1.5, 0.3774047358083551}, {1.5, (2 + Sqrt[3])/2, 0},
{(2 + Sqrt[3])/2, 0.5, 0}, {2, 1, 0}, {(2 + Sqrt[3])/2, 1.5, 0}}
ListPlot3D[circle,
PlotStyle -> None,
PlotTheme -> "Detailed",
Mesh -> {3, 3},
AxesLabel -> {"x", "y", "ϕ(x,y)"},
InterpolationOrder -> 2,
LabelStyle -> Directive[FontFamily -> "Courier New"]]


• What is kor ?
– ciao
Apr 4 '15 at 6:58
• @rasher sorry, i corrected, kor=circle Apr 4 '15 at 7:00
• I don't understand in what sense "subtract" or "withdrawn." The domains are different, so do you want to subtract the smaller circle from the greater, leaving a hole? Do you want to subtract the ordinates over the intersection of the domains? Likewise, do you want an interpolation of the "another" and subtract it from Φ over the intersection of the domains? Something else, perhaps? Apr 4 '15 at 12:07
• @MichaelE2 I want to substract the smaller circle from the greater, leaving a hole, like you wrote firstly. And that way get the difference between the two circle. The domain is R=1 at the circles. (Both of them) Then I want to present it on a circle domain with interpolation. Apr 4 '15 at 13:44
• Welcome to Mathematica.SE! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Read the faq! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! Apr 4 '15 at 21:36

I think this is what you mean:

Plot3D[Φ, {x, y} ∈
RegionDifference[DiscretizeRegion@Ω,
ConvexHullMesh[circle[[All, 1 ;; 2]]]], PlotStyle -> None,
PlotTheme -> "Detailed", Mesh -> {25},
AxesLabel -> {"x", "y", "ϕ(x,y)"},
LabelStyle -> Directive[FontFamily -> "Courier New"]]


But perhaps I subtracted them in the wrong order, or plotted the wrong function. In which case, maybe this:

ListPlot3D[circle, PlotStyle -> None, PlotTheme -> "Detailed",
Mesh -> {3, 3}, AxesLabel -> {"x", "y", "ϕ(x,y)"},
InterpolationOrder -> 2,
LabelStyle -> Directive[FontFamily -> "Courier New"],
RegionFunction ->
Function[{x, y}, {x, y} ∉ Ω]
]