2
$\begingroup$

Is there any easy and reliable way to improve RegionPlot3D other than using the slow and sometimes useless option PlotPoints?

I did find many alternatives but none are easy and many are not reliable (that only works for some cases).

Some plots made using RegionPlot3D are so bad that results are misleading, for example when plotting a convex hull or linear domains.

Example:

v1 = {3, 0.5, 0.5}; v2 = {0.5, 3, 0.5}; v3 = {0.5, 0.5,3};
A = Transpose[{v1, v2, v3}];

reg=Thread[0 <= LinearSolve[A, {x, y, z}]];
IR = ImplicitRegion[reg, {x, y, z}];
r=RegionPlot3D[IR,PlotRange ->{ { 0,  5}, { 0,  5}, { 0,  5}}];
Show[r, Axes -> True, AxesLabel -> {x, y, z},BoxRatios -> Automatic]

The result is totally unacceptable, even when you use 100 points, which is slow.

$\endgroup$
0

1 Answer 1

2
$\begingroup$

One way is DiscretizeRegion before use RegionIntersection

v1 = {3, 0.5, 0.5}; v2 = {0.5, 3, 0.5}; v3 = {0.5, 0.5, 3};
A = Transpose[{v1, v2, v3}];
reg = Thread[0 <= LinearSolve[A, {x, y, z}]];
IR = ImplicitRegion[#, {x, y, z}] & /@ reg;
RegionPlot3D[
 RegionIntersection[
  DiscretizeRegion[#, {{0, 5}, {0, 5}, {0, 5}}] & /@ IR], 
 Axes -> True]

enter image description here

$\endgroup$
4
  • $\begingroup$ The intersection command seems to assume the variables x, y and z are finite. That is, the intersection only plots part of the volume. If you add Axes -> True, and compare both results you will see they are different. Thanks. $\endgroup$
    – root
    Commented Jan 7, 2022 at 0:01
  • $\begingroup$ @root Do you mean your other post ? v1 = {1, 0.2, 0.2}; v2 = {0.2, 2, 0.2}; v3 = {0.2, 0.2, 3}; V = Transpose[{v1, v2, v3}]; S1 = ParametricRegion[{V . {x, y, z}, x >= 0}, {x, y, z}] // DiscretizeRegion; S2 = ParametricRegion[{V . {x, y, z}, y >= 0}, {x, y, z}] // DiscretizeRegion; S3 = ParametricRegion[{V . {x, y, z}, z >= 0}, {x, y, z}] // DiscretizeRegion; Region[RegionIntersection[S1, S2, S3], BaseStyle -> Cyan] $\endgroup$
    – cvgmt
    Commented Jan 7, 2022 at 0:02
  • $\begingroup$ Sorry, I've deleted some comments since I've resolved them. If you compare the original plot in this question with the plot generated by your answer, you will see they are different. You need to add Axes -> True to see this. $\endgroup$
    – root
    Commented Jan 7, 2022 at 0:05
  • $\begingroup$ @root You can add the rangement {{0, 5}, {0, 5}, {0, 5}} in ImplicitRegion or DiscretizeRegion See the updated. $\endgroup$
    – cvgmt
    Commented Jan 7, 2022 at 0:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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