Message Boards Message Boards

0
|
5439 Views
|
10 Replies
|
0 Total Likes
View groups...
Share
Share this post:

Cutting a cuboid with a plane

Posted 3 years ago

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:
POSTED BY: agilicz
10 Replies

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 BY: Gianluca Gorni
Posted 3 years 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

POSTED BY: agilicz

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 3 years ago

Dear Christopher,

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

Best regards,

Andras

POSTED BY: agilicz

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

POSTED BY: Gianluca Gorni
Posted 3 years ago

Well, this would be certainly an overkill.

Best regards, Andras

POSTED BY: agilicz

Here is a way:

RegionIntersection[Cuboid[{ -2 , -2 , -2 } , { 4 , 4 , 4 } ], 
  InfinitePlane[{{0, 0, 0}, {0, 1, 1}, {1, 0, 1}}]] // InputForm
POSTED BY: Gianluca Gorni
Posted 3 years 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

POSTED BY: agilicz
Posted 3 years 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

POSTED BY: agilicz

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 BY: Gianluca Gorni
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