Geometry 似乎与RegionPlot3D生成的区域不匹配,在Edit3D中添加了一个有意义的示例,谢谢…这比我预期的要多一些。我找到了一个建议。使用Reduce获得一组约束,2。将所有不等式约束替换为等式约束和3。在此方程组上使用FindInstance。检查完整格

Geometry 似乎与RegionPlot3D生成的区域不匹配,在Edit3D中添加了一个有意义的示例,谢谢…这比我预期的要多一些。我找到了一个建议。使用Reduce获得一组约束,2。将所有不等式约束替换为等式约束和3。在此方程组上使用FindInstance。检查完整格,geometry,wolfram-mathematica,visualization,Geometry,Wolfram Mathematica,Visualization,似乎与RegionPlot3D生成的区域不匹配,在Edit3D中添加了一个有意义的示例,谢谢…这比我预期的要多一些。我找到了一个建议。使用Reduce获得一组约束,2。将所有不等式约束替换为等式约束和3。在此方程组上使用FindInstance。检查完整格式[减少[cons]],第2步似乎很难完成谢谢,看起来真的很不错!我想我有办法去掉脸上多余的线条,我会在一周内更新我的帖子bit@Yaroslav退化的解决方案对你来说是个问题吗?你的eq.系统有时会生成无限个圆柱体(我没有检查平面和孤立点是否


似乎与RegionPlot3D生成的区域不匹配,在Edit3D中添加了一个有意义的示例,谢谢…这比我预期的要多一些。我找到了一个建议。使用Reduce获得一组约束,2。将所有不等式约束替换为等式约束和3。在此方程组上使用FindInstance。检查完整格式[减少[cons]],第2步似乎很难完成谢谢,看起来真的很不错!我想我有办法去掉脸上多余的线条,我会在一周内更新我的帖子bit@Yaroslav退化的解决方案对你来说是个问题吗?你的eq.系统有时会生成无限个圆柱体(我没有检查平面和孤立点是否也存在)@Yaroslav ConvexHull3D无法处理这些问题。我已经经历过了。有一种简单的方法可以使用FindInstance来检测圆柱体,以找到至少有一个坐标值大于预期边界的randomCons的解决方案。该方法还可以检测平面。。。但不是孤立点。但是,由于点应该是共面的,您可以检查共面性。嘿,我回到您的解决方案来进行一些其他可视化,我想知道,您是如何找到“Graphics
Mesh
FlatFaces”选项的?抱歉,我用最终解决方案替换了我原来的问题,这让人困惑。如果您进入“编辑历史记录”并查看原始问题,您会发现问题在于RegionPlot3D为我所使用的系统类型提供了低质量的绘图needed@Yaroslav:我建议你将你的答案从问题中复制粘贴到新的答案中,然后将你的问题还原到以前的版本。那就不会那么令人困惑了,你不觉得吗?修正了。我认为最好是将已接受答案的摘要/浓缩版本附加到问题本身,而不是将其作为单独的答案添加 randomCons := Module[{}, hadamard = KroneckerProduct @@ Table[{{1, 1}, {1, -1}}, {3}]; invHad = Inverse[hadamard]; vs = Range[8]; m = mm /@ vs; sectionAnchors = Subsets[vs, {1, 7}]; randomSection := Mean[hadamard[[#]] & /@ #] & /@ Prepend[RandomChoice[sectionAnchors, 3], vs]; {p0, p1, p2, p3} = randomSection; section = Thread[m -> p0 + {x, y, z}.Orthogonalize[{p1 - p0, p2 - p0, p3 - p0}]]; And @@ Thread[invHad.m >= 0 /. section] ]; Table[RegionPlot3D @@ {randomCons, {x, -3, 3}, {y, -3, 3}, {z, -3, 3}}, {10}] (* Plots feasible region of a linear program in 3 variables, \ specified as cons[[1]]>=0,cons[[2]]>=0,... Each element of cons must \ be an expression of variables x,y,z only *) plotFeasible3D[cons_] := Module[{maxVerts = 20, vcons, vertCons, polyCons}, (* find intersections of all triples of planes and get rid of \ intersections that aren't points *) vcons = Thread[# == 0] & /@ Subsets[cons, {3}]; vcons = Select[vcons, Length[Reduce[#]] == 3 &]; (* Combine vertex constraints with inequality constraints and find \ up to maxVerts feasible points *) vertCons = Or @@ (And @@@ vcons); polyCons = And @@ Thread[cons >= 0]; verts = {x, y, z} /. FindInstance[polyCons && vertCons, {x, y, z}, maxVerts]; ComputationalGeometry`Methods`ConvexHull3D[verts, Graphics`Mesh`FlatFaces -> False] ] randomCons := Module[{}, hadamard = KroneckerProduct @@ Table[{{1, 1}, {1, -1}}, {3}]; invHad = Inverse[hadamard]; vs = Range[8]; m = mm /@ vs; sectionAnchors = Subsets[vs, {1, 7}]; randomSection := Mean[hadamard[[#]] & /@ #] & /@ Prepend[RandomChoice[sectionAnchors, 3], vs]; {p0, p1, p2, p3} = randomSection; section = Thread[m -> p0 + {x, y, z}.Orthogonalize[{p1 - p0, p2 - p0, p3 - p0}]]; And @@ Thread[invHad.m >= 0 /. section] ]; Table[plotFeasible3D[List @@ randomCons[[All, 1]]], {50}];
cons = randomCons;  (* Your function *)
eqs = Apply[Equal, List @@@ Subsets[cons, {3}], {2}];
sols = Flatten[{x, y, z} /. Table[Solve[eq, {x, y, z}], {eq, eqs}], 1];
pts = Select[sols, And @@ (NumericQ /@ #) &];
ComputationalGeometry`Methods`ConvexHull3D[pts]
{p0, p1, p2, 
   p3} = {{1, 0, 0, 0, 0, 0, 0, 0}, {1, 1/2, -(1/2), 0, -(1/2), 0, 
    0, -(1/2)}, {1, 0, 1/2, 1/2, 0, 0, -(1/2), 1/2}, {1, -(1/2), 1/2, 
    0, -(1/2), 0, 0, -(1/2)}};
hadamard = KroneckerProduct @@ Table[{{1, 1}, {1, -1}}, {3}];
invHad = Inverse[hadamard];
vs = Range[8];
m = mm /@ vs;
section = 
  Thread[m -> 
    p0 + {x, y, z}.Orthogonalize[{p1 - p0, p2 - p0, p3 - p0}]];
cons = And @@ Thread[invHad.m >= 0 /. section];
eqs = Apply[Equal, List @@@ Subsets[cons, {3}], {2}];
sols = Flatten[{x, y, z} /. Table[Solve[eq, {x, y, z}], {eq, eqs}], 
    1]; // Quiet
pts = Select[sols, And @@ (NumericQ /@ #) &];
ptPic = Graphics3D[{PointSize[Large], Point[pts]}];
regionPic = 
  RegionPlot3D[cons, {x, -2, 2}, {y, -2, 2}, {z, -2, 2}, 
   PlotPoints -> 40];
Show[{regionPic, ptPic}]
regionPts = regionPic[[1, 1]];
nf = Nearest[regionPts];
trimmedPts = Select[pts, Norm[# - nf[#][[1]]] < 0.2 &];
trimmedPtPic = Graphics3D[{PointSize[Large], Point[trimmedPts]}];
Show[{regionPic, trimmedPtPic}]
rstatic = randomCons;                    (* Call your function *)
randeq = rstatic /. x_ >= y_ -> x == y;  (* make a set of plane equations 
                                            replacing the inequalities by == *)

eqset = Subsets[randeq, {3}];            (* Make all possible subsets of 3 planes *)

                                         (* Now find the vertex candidates
                                            Solving the sets of three equations *)
vertexcandidates =      
    Flatten[Table[Solve[eqset[[i]]], {i, Length[eqset]}], 1];

                                         (* Now select those candidates 
                                            satisfying all the original equations *)          
vertex = Union[Select[vertexcandidates, rstatic /. # &]];

                                         (* Now use an UNDOCUMENTED Mathematica
                                            function to plot the surface *)

gr1 = ComputationalGeometry`Methods`ConvexHull3D[{x, y, z} /. vertex];
                                         (* Your plot follows *)
gr2 = RegionPlot3D[rstatic,
        {x, -3, 3}, {y, -3, 3}, {z, -3, 3},
         PerformanceGoal -> "Quality", PlotPoints -> 50]

Show[gr1,gr2]   (*Show both Graphs superposed *)
 ComputationalGeometry`Methods`ConvexHull3D[{x, y, z} /. vertex,
                                Graphics`Mesh`FlatFaces -> False]
 {{x -> Sqrt[3/5]}, 
  {x -> -Sqrt[(5/3)] + Sqrt[2/3] y}, 
  {x -> -Sqrt[(5/3)], y -> 0}, 
  {y -> -Sqrt[(2/5)], x -> Sqrt[3/5]}, 
  {y -> 4 Sqrt[2/5],  x -> Sqrt[3/5]}
 }
{{x -> -Sqrt[(5/3)] + (2 z)/Sqrt[11]}, 
 {x -> Sqrt[3/5], z -> 0}, 
 {x -> -Sqrt[(5/3)], z -> 0}, 
 {x -> -(13/Sqrt[15]), z -> -4 Sqrt[11/15]}, 
 {x -> -(1/Sqrt[15]),  z -> 2 Sqrt[11/15]}, 
 {x -> 17/(3 Sqrt[15]), z -> -((4 Sqrt[11/15])/3)}
}
For[i = 1, i <= 160, i++,
 rstatic = randomCons;
 r[i] = rstatic;
 s1 = Reduce[r[i], {x, y, z}] /. {x -> var1, y -> var2, z -> var3};
 s2 = Union[StringCases[ToString[FullForm[s1]], "var" ~~ DigitCharacter]];

 If [Dimensions@s2 == {3},

  (randeq = rstatic /. x_ >= y_ -> x == y;
   eqset = Subsets[randeq, {3}];
   vertexcandidates = Flatten[Table[Solve[eqset[[i]]], {i, Length[eqset]}], 1];
   vertex = Union[Select[vertexcandidates, rstatic /. # &]];
   a[i] = ComputationalGeometry`Methods`ConvexHull3D[{x, y, z} /. vertex, 
            Graphics`Mesh`FlatFaces -> False, Axes -> False, PlotLabel -> i])
  ,

   a[i] = RegionPlot3D[s1, {var1, -2, 2}, {var2, -2, 2}, {var3, -2, 2},
             Axes -> False, PerformanceGoal -> "Quality", PlotPoints -> 50, 
             PlotLabel -> i, PlotStyle -> Directive[Yellow, Opacity[0.5]], 
             Mesh -> None]
  ];
 ]

GraphicsGrid[Table[{a[i], a[i + 1], a[i + 2]}, {i, 1, 160, 4}]]
RegionPlot3D[  2*y+3*z <= 5 &&  x+y+2*z <= 4 && x+2*y+3*z <= 7 &&
               x >= 0 && y >= 0 && z >= 0,
             {x, 0, 4}, {y, 0, 5/2}, {z, 0, 5/3} ]