agilicz
(agilicz)
1
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
CutCube.nb (25.2 KB)
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}]]]
agilicz
(agilicz)
3
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
agilicz
(agilicz)
5
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.
agilicz
(agilicz)
7
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
christopher
(Christopher Wolfram)
8
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]]
agilicz
(agilicz)
9
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.
agilicz
(agilicz)
11
Well, this would be certainly an overkill.
Best regards,
Andras