Message Boards Message Boards

GROUPS:

Cutting a cuboid with a plane

Posted 9 months ago
1622 Views
|
10 Replies
|
0 Total Likes
|

Dear Community,

I'm cutting (cliping away) a cuboid with an Infinity plane.

  • How can I obtain i.e. separate the two resulting objects behind and in front of the plane?
  • How can I visualize each of them?
  • How I can extract the x, y, z coordinates of the corners of the obtained objects?
  • How can I get the intersection polygon on the cutting plane?

Notebook attached. Tx for the kind helpin advance, best regards, Andras

Attachments:
10 Replies

One way is with Region computation:

RegionPlot3D[
 RegionIntersection[Cuboid[{ -2. , -2. , -2. } , { 4. , 4. , 4. } ], 
  HalfSpace[Cross[{0, 1, 1}, {1, 0, 1}], {0, 0, 0}]]]
RegionPlot3D[
 RegionDifference[Cuboid[{ -2. , -2. , -2. } , { 4. , 4. , 4. } ], 
  HalfSpace[Cross[{0, 1, 1}, {1, 0, 1}], {0, 0, 0}]]]
Posted 9 months ago

Dear Gianluca,

Tx very much. Two more questions remain:

  • how I can extract the x, y, z coordinates of the corperpoints of the obtained objects?
  • how I can get the polygon (its points) on the cuting plane?

Tx for the kind help, best regards Andras

Here is a way:

RegionIntersection[Cuboid[{ -2 , -2 , -2 } , { 4 , 4 , 4 } ], 
  InfinitePlane[{{0, 0, 0}, {0, 1, 1}, {1, 0, 1}}]] // InputForm
Posted 9 months ago

Dear Gianluca,

Awsome, tx very much. Just one more tiny help:

how I can extract the x, y, z coordinates of the corperpoints of the obtained objects?

Tx for the kind help in advance, best regards Andras

I find Region computation very frustrating, because there are glaring holes in functionality. For example, this gives useless output:

cubd = Cuboid[{-2, -2, -2}, {4, 4, 4}];
hlfsp = HalfSpace[{-1, -1, 1}, {0, 0, 0}];
RegionIntersection[cubd, hlfsp]

However, if I replace the HalfSpace with a large enough Simplex I get the intersection as a real Polyhedron:

smpl = Simplex[{{24, -10, 14}, {-8, 22, 14}, {-24, -4, -28}, {20, 
     20, -20}}];
RegionWithin[smpl, RegionIntersection[cubd, hlfsp]]
RegionIntersection[cubd, smpl] // Rationalize // Chop // InputForm

It is irritating that I need to Rationalize and Chop the result.

Posted 9 months ago

Dear Gianluca,

Thanks for your kind help, maybe Wolfram improves it in the upcoming versions. For me it was a great help anyway.

Thanks and best regards Andras

In your first example, the intersection is being represented symbolically. You can get a mesh back using BoundaryDiscretizeRegion:

cubd = Cuboid[{-2, -2, -2}, {4, 4, 4}];
hlfsp = HalfSpace[{-1, -1, 1}, {0, 0, 0}];
BoundaryDiscretizeRegion[RegionIntersection[cubd, hlfsp]]
Posted 9 months ago

Dear Christopher,

Tx for the kind help, I'm a newbie in Region computing. I'll test it immediately.

Best regards,

Andras

You can discretize the region, but then you get a fine mesh, almost 2000 vertices.

Posted 9 months ago

Well, this would be certainly an overkill.

Best regards, Andras

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