Message Boards Message Boards

0
|
5507 Views
|
8 Replies
|
1 Total Likes
View groups...
Share
Share this post:

Cut a 3D surface by a horizontal plane?

Posted 3 years ago

Dear Community,

I've reconstructed a pond from its contourline polygons, and plotted it. The depth of the pond ranges from 0 ft to -70 ft. Now I would like to see where the water would be in the pond at -45ft depth? Mathematically: how to cut this 3D surface with a horizontal plane at -45 vertical value and plot both surface and obtained polygon? Unfortunately I'm unexperienced in this field and would appreciate your kind help here. Files are attached.

Tx in advance. Best regards, Andras

Attachments:
POSTED BY: agilicz
8 Replies
Posted 3 years ago

Dear Seth,

Tx very much, works perfectly well for my goals, and I learned a lot. Now ready to take a bath in the pond :-)

Best regards, Andras

POSTED BY: agilicz

The following is not ideal, but it will work for your particular problem reasonably well:

Step 1: create a function of x and y and interpolates the height of the pond surface; the DeleteDuplicates function is slightly problematic in that it sweeps under the rug the possibility of a pond that could have "caves". Hopefully yours does not.

Interpolation[DeleteDuplicatesBy[allpoints, Most], 
 InterpolationOrder -> 1]

Step 2: use RegionFunction to suppress points in the "water" that lie beneath the elevation of the pond;

pondwater = Plot3D[-45, {x, 0, 700}, {y, 0, 700}, 
 PlotStyle -> {Opacity[0.5], Blue}, 
 RegionFunction -> (-45 > i[#1, #2] &)]

Step 3: combine Graphics3D objects

Show[myListSurfacePlot3D,pondwater]
POSTED BY: Seth Chandler
Posted 3 years ago

Dear Seth,

Wow, tx very much, very elegant! Would it be also somehow possible to clip the plane outside the pond?

Tx in advance, best regards Andras

POSTED BY: agilicz

A different approach, where the shape of the pond is extracted from the mesh line primitives:

pr = ListSurfacePlot3D[allpoints,
  PlotRange -> {All, All, {-130, -45}},
  MeshFunctions -> {#3 &}, Mesh -> {{-45}}]
lns = Cases[Normal[pr[[1]]], Line[{{_, _, -45.}, __}], All];
Show[ListSurfacePlot3D[allpoints, MeshFunctions -> {#3 &}], 
 Graphics3D[{Opacity[.5], Blue, Polygon @@ lns[[1]]}]]
POSTED BY: Gianluca Gorni

Clever. I thought there might be many ways to do this. Yours will do better with ponds that have caves or that are not functions in the z direction.

POSTED BY: Seth Chandler

A pond with an island may be a problem, too.

POSTED BY: Gianluca Gorni
Posted 3 years ago

Dear Gianluca,

Thank you very much, works very nice! It will take me some time to fully understand it, but I'll do my best.

Tx and best regards, Andras

POSTED BY: agilicz

Here's a sketch of how to combine graphics, where myListSurfacePlot3D corresponds to the "pond" you created in your notebook:

Show[myListSurfacePlot3D,Graphics3D[{Opacity[0.5],Blue,InfinitePlane[{{0,0,-45},{1,0,-45},{0,1,-45}}]}]]
POSTED BY: Seth Chandler
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract