6
$\begingroup$

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"]]

enter image description here

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"]]

enter image description here

$\endgroup$
9
  • $\begingroup$ What is kor ? $\endgroup$
    – ciao
    Apr 4, 2015 at 6:58
  • $\begingroup$ @rasher sorry, i corrected, kor=circle $\endgroup$
    – wlkyr
    Apr 4, 2015 at 7:00
  • $\begingroup$ 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? $\endgroup$
    – Michael E2
    Apr 4, 2015 at 12:07
  • $\begingroup$ @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. $\endgroup$
    – wlkyr
    Apr 4, 2015 at 13:44
  • 1
    $\begingroup$ 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! $\endgroup$
    – Michael E2
    Apr 4, 2015 at 21:36

1 Answer 1

11
+500
$\begingroup$

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"]]

Mathematica graphics

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} ∉ Ω]
 ]

Mathematica graphics

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.