Group Abstract Group Abstract

Message Boards Message Boards

Discrete surface plane intersection

GROUPS:
Hi,

I have a discrete surface (3D data points) and i try to found the interpolate values (discretes) of the surface intersection by a plane. Any idea to perform this problem ?
POSTED BY: Laurent Barrallier
Answer
5 months ago
Hello Laurent,
Without knowing more about your problem, here is what you are up against:
surface =
Flatten[Table[{{x, y},
    Sin[x + y + RandomReal[{-0.1, 0.1}]] Sin[2 Pi y x]}, {x, 0, 2 Pi,
    2 Pi/24}, {y, 0, 2 Pi, 2 Pi/24}], 1]

intSurface = Interpolation[surface]

Plot3D[intSurface[x, y], {x, 0, 2 Pi}, {y, 0, 2 Pi}]
planeExample =  1/4 + 1/3 x - 2/3 y
Plot3D[{intSurface[x, y], planeExample}, {x, 0, 2 Pi}, {y, 0, 2 Pi},
PlotStyle -> {Red, Green}]
ContourPlot[
intSurface[x, y] == planeExample, {x, 0, 2 Pi}, {y, 0, 2 Pi}]


There are ways of extracting the points for the curves from the GraphicsComplex for the above. It is a bit tedious, but do-able. If you are still interested, I can track down some links to discussion of how to do this. There is a current discussion and links under the (something like) "New Functions in Mathematica Wishlist" thread in this forum.
POSTED BY: W. Craig Carter
Answer
5 months ago
Thank you,

In fact, I have non grid data (it exists in the Mathematica Library Archive package such as http://library.wolfram.com/infocenter/MathSource/7760/ to perform  interpolation) and I would like to have the result in the 3D original axis (cutting planes can be perpendicular to x,y axis) in order to know the coordinates of the curves (intersection line(s)) points. 
POSTED BY: Laurent Barrallier
Answer
5 months ago
Craig, I somehow missed this answer - I like it a lot. Here is a small app to watch things in action:
 Manipulate[
 
  Row[{
    ContourPlot[
     intSurface[x, y] == c + a x - b y, {x, -Pi, Pi}, {y, -Pi, Pi},
     ImageSize -> 300],
    Plot3D[{intSurface[x, y], c + a x - b y}, {x, -Pi, Pi}, {y, -Pi,
      Pi}, PlotStyle -> {Yellow, Red}, Mesh -> None, PlotPoints -> 30,
     ViewPoint -> {0.01, -2.14, 2.62}, ViewVertical -> {0, 0, 1},
    SphericalRegion -> True, ImageSize -> 450]
   }],

{{a, .275, "X-slope"}, -1, 1, Appearance -> "Labeled"},
{{b, .235, "Y-slope"}, -1, 1, Appearance -> "Labeled"},
{{c, .25, "height"}, -2, 2, Appearance -> "Labeled"},

Initialization :>
  (surface =
    Flatten[Table[{{x, y},
       Sin[x + y + RandomReal[{-0.1, 0.1}]] Sin[2 Pi y x]}, {x, -Pi,
       Pi, 2 Pi/24}, {y, -Pi, Pi, 2 Pi/24}], 1];
   intSurface = Interpolation[surface];)]

POSTED BY: Vitaliy Kaurov
Answer
3 months ago