0
|
5051 Views
|
4 Replies
|
0 Total Likes
View groups...
Share

# 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
4 Replies
Sort By:
Posted 9 years ago
 Thanks And @@ {constraint1, ...., constraintn} works!
Posted 9 years ago
 To convert {cons1, cons2, ...} to cons1 && cons2 && ... you want to do And @@ {cons1, cons2, ...}
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[] - P[]*x - P[]*y <= z && P[] - P[]*x - P[]*y > z - 1, {x, u[], v[]}, {y, u[], v[]}, {z, u[], v[]}, 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]][] + b*P[[i]][] + c*P[[i]][] == d, col = Red; AppendTo[lU, P[[i]]]; AppendTo[laff, RegionOfConstraint[P[[i]], {-10, -10, -10}, {10, 10, 10}, col, .1]], If[a*P[[i]][] + b*P[[i]][] + c*P[[i]][] == 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 9 years ago
 If the volumes are defined by constraints, you could do RegionPlot[ constraint1 && constraint2 && ...]