3
$\begingroup$

Answers to an earlier posting, ConvexHullMesh inconsistency, have let me construct a particular 3D region by intersecting a pyramid with a halfspace:

Rint = RegionIntersection[Rhalfspace, RPyramid]

The construction is correct, and the region displays like this upon executing the above command:


Rint


The slanted plane is (correctly) caused by `Rhalfspace`. The two vertical planes are caused by some type of plotrange clipping. My question is simple:

Q. How do I display the full region?

I've tried RegionPlot3D, DiscretizeRegion, but nothing I try allows me to e.g., use PlotRange. I am missing something basic about how to convert a region to a 3D graphics object.


Rhalfspace = HalfSpace[{0.694747,0.186157,0.694747},{0.622008,0.166667,0.333333}];

pts={{1., 0., 0.}, {0.866025, 0.5, 0.}, {0.5, 0.866025, 0.}, {0., 1., 
  0.}, {-0.5, 0.866025, 0.}, {-0.866025, 0.5, 0.}, {-1., 0., 
  0.}, {-0.866025, -0.5, 0.}, {-0.5, -0.866025, 0.}, {0., -1., 
  0.}, {0.5, -0.866025, 0.}, {0.866025, -0.5, 0.}, {0., 0., 2.}};

RPyramid = Region[BoundaryMesh[DelaunayMesh[pts]]]

Rint = RegionIntersection[Rhalfspace, RPyramid]

***Added***. Following @flinty's use of `ImplicitRegion`:

Rint2

$\endgroup$
  • 1
    $\begingroup$ What did DiscretizeRegion say? Please post the errors and give something we can execute, as we don't have Rhalfspace, RPyramid. If you have the mesh from mesh = DiscretizeRegion[...] then that is the whole mesh - To embed in Graphics3D just put it in there Graphics3D[{mesh}] $\endgroup$ – flinty Jul 18 at 14:58
  • $\begingroup$ @flinty: OK, will include code. Will take a bit ... $\endgroup$ – Joseph O'Rourke Jul 18 at 15:03
  • $\begingroup$ @flinty: Graphics3D[{Rint}] says Region is not a Graphics3D primitive or directive. $\endgroup$ – Joseph O'Rourke Jul 18 at 15:09
  • 1
    $\begingroup$ SolidRegionQ[Rhalfspace] is False - instead of intersecting with a HalfSpace, use a big cuboid instead. These operations with HalfSpace crash on my machine 12.1.1 after the first run. $\endgroup$ – flinty Jul 18 at 15:14
  • 1
    $\begingroup$ This works: reg = ImplicitRegion[-3 < {0.694747, 0.186157, 0.694747}.({x, y, z} - {0.622008, 0.166667, 0.333333}) < 0 && -2 < x < 2 && -2 < y < 2 && -2 < z < 2, {x, y, z}]; then RegionIntersection[DiscretizeRegion@reg, RPyramid] $\endgroup$ – flinty Jul 18 at 15:43
3
$\begingroup$

There appear to be some problems using HalfSpace. I've worked around this using an ImplicitRegion instead that matches up with the HalfSpace but produces a bounded object when discretized:

reg = ImplicitRegion[-3 < {0.694747, 0.186157, 
       0.694747}.({x, y, z} - {0.622008, 0.166667, 0.333333}) < 
     0 && -2 < x < 2 && -2 < y < 2 && -2 < z < 2, {x, y, z}];

RegionIntersection[DiscretizeRegion@reg, RPyramid]

This produces the full part of the cone you wanted with the top removed: enter image description here

| improve this answer | |
$\endgroup$
  • $\begingroup$ Thanks so much for experimenting! I really appreciate it. $\endgroup$ – Joseph O'Rourke Jul 18 at 16:01
2
$\begingroup$

If I do the following incantation:

bounds = RegionBounds[Rint]

(*  {{-1., 1.}, {-1., 1.}, {0., 2.}}  *)

Append[Rint, PlotRange -> %]

I get this:

enter image description here

This also often succeeds:

Append[Rint, PlotRange -> {{-1.`, 1.`}, {-1.`, 1.`}, {0.`, 2.`}}]

Either of these has usually failed in my trials (runs until I kill the kernel; succeeded only once each in say a dozen or more tries):

Append[Rint, PlotRange -> bounds]
Append[Rint, PlotRange -> RegionBounds[Rint]]

Sometimes, I have to kill the kernel twice: When it restarts, it hangs when it computes Rint.

Doing the first command multiple times (or any of the commands, if they succeed at first) ultimately hangs the kernel.

| improve this answer | |
$\endgroup$
  • $\begingroup$ Could you explain the use of Append here? Why does it work to append graphics options to a region? $\endgroup$ – Joseph O'Rourke Jul 18 at 16:28
  • 1
    $\begingroup$ @JosephO'Rourke From the docs for Region: "Region has the same options as Graphics for embedding dimension 2 and the same options as Graphics3D for embedding dimension 3, with the following additions and changes...." You can also add them to RegionIntersection and probably most other region operations, but in your example, the kernel always hangs for me, and I have to kill it. $\endgroup$ – Michael E2 Jul 18 at 18:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.