Message Boards Message Boards

0
|
5222 Views
|
4 Replies
|
0 Total Likes
View groups...
Share
Share this post:

How can I compute the intersection of several Regionplot3D?

Posted 9 years ago

Hi

In a loop I compute several volumes and put them in a list.

I need to compute their intersection.

The "intersection" function seems not applicable on this kind of list.

Could anyone tell me how to perform intersection of volumes obtained by RegionPlot3D?

Best regards

POSTED BY: jean Ouattara
4 Replies
Posted 9 years ago

Thanks

And @@ {constraint1, ...., constraintn} works!

POSTED BY: jean Ouattara

To convert {cons1, cons2, ...} to cons1 && cons2 && ... you want to do And @@ {cons1, cons2, ...}

POSTED BY: Frank Kampas
Posted 9 years ago

The volumes are defined by constraints but , as I compute the volumes (constraints) in a loop, I could just have a list of constraints (constraint1, constraint2, ...constraintn).

I tryed to apply "And" upon the list but it doesn't work. I tried then to make the RegionPlot3D of each constraints and then use the "Intersection" of them, but it doesn't work too.

I join the code


RegionOfConstraint[P_, u_, v_, col_, o_] := Module[{x, y, z, laff},
   laff = {};
   RegionPlot3D[
    P[[3]] - P[[1]]*x - P[[2]]*y <= z && 
     P[[3]] - P[[1]]*x - P[[2]]*y > z - 1,
    {x, u[[1]], v[[1]]}, {y, u[[2]], v[[2]]}, {z, u[[3]], v[[3]]}, 
    PlotPoints -> 50, PlotRange -> All, Mesh -> None, 
    PlotStyle -> Directive[col, Opacity[o]]]
   ];

IntersectionOfRegions[P_, u_, v_, a_, b_, c_, d_] := 
  Module[{x, y, z, laff, i, j, ll, col, lU, lL},
   laff = {}; lU = {}; lL = {};
   For[i = 1, i <= Length[P], i++,
    If[a*P[[i]][[1]] + b*P[[i]][[2]] + c*P[[i]][[3]] == d,
      col = Red; AppendTo[lU, P[[i]]];
      AppendTo[laff, 
       RegionOfConstraint[P[[i]], {-10, -10, -10}, {10, 10, 10}, 
        col, .1]],
      If[a*P[[i]][[1]] + b*P[[i]][[2]] + c*P[[i]][[3]] == d + c - 1,
       col = Blue; AppendTo[lL, P[[i]]];
       AppendTo[laff, 
        RegionOfConstraint[P[[i]], {-10, -10, -10}, {10, 10, 10}, 
         col, .1]],
       col = LightGray
       ]
      ];
    ];
   Show[Intersection[laff]]
   ];
Attachments:
POSTED BY: jean Ouattara

If the volumes are defined by constraints, you could do RegionPlot[ constraint1 && constraint2 && ...]

POSTED BY: Frank Kampas
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