Skip to main content
deleted 483 characters in body
Source Link
cvgmt
  • 93.6k
  • 6
  • 115
  • 200
Clear["Global`*"];
{f, g, h} = {{-257, -240, -46, 477}, {-359, -222, 192, 461}, {0, 0, 0,
      0}} . {1, x, y, z};
reg1toSpace = RegionIntersection[
   HalfSpace[Coefficient[g - fHalfSpace[Coefficient[#, {x, y, z}], 
    Coefficient[g - fCoefficient[#, {x, y, z}] . {x, y, z} - (g - f)], 
   HalfSpace[Coefficient[h - f, {x, y, z}],#] &;
  reg1 = Coefficient[hRegionIntersection[toSpace[g - f, {x, y, z}] . {x, yf], z} - (htoSpace[h - f)]];f]];
reg2 = RegionIntersection[
   HalfSpace[Coefficient[f - g, {x, y, z}], 
    Coefficient[f - g, {x, y, z}] . {x, y, z} - (f - g)], 
   HalfSpace[Coefficient[h - g, {x, y, z}], 
    Coefficient[hRegionIntersection[toSpace[f - g, {x, y, z}] . {x, yg], z} - (htoSpace[h - g)]];g]];
reg3 = RegionIntersection[
   HalfSpace[Coefficient[f - h, {x, y, z}], 
    Coefficient[fRegionIntersection[toSpace[f - h, {x, y, z}] . {x, yh], z} - (ftoSpace[g - h)], h]];
   HalfSpace[Coefficient[g - h, {xreg1, yreg2, zreg3}], 
   = Coefficient[g 
 - h, {xRegionIntersection[#, y,Cuboid[]] z}]& ./@ {x, y, z} - (g - h)]];
reg1 = RegionIntersection[reg1, Cuboid[]];
reg2 = RegionIntersection[reg2, Cuboid[]];
reg3 = RegionIntersection[reg3, Cuboid[]];};
ConvexRegionQ /@ {reg1, reg2, reg3}
{Region[Style[reg1, Red]], Region[Style[reg2, Green]], 
 Region[Style[reg3, Blue]]}
% // Show
Clear["Global`*"];
{f, g, h} = {{-257, -240, -46, 477}, {-359, -222, 192, 461}, {0, 0, 0,
      0}} . {1, x, y, z};
reg1 = RegionIntersection[
   HalfSpace[Coefficient[g - f, {x, y, z}], 
    Coefficient[g - f, {x, y, z}] . {x, y, z} - (g - f)], 
   HalfSpace[Coefficient[h - f, {x, y, z}], 
    Coefficient[h - f, {x, y, z}] . {x, y, z} - (h - f)]];
reg2 = RegionIntersection[
   HalfSpace[Coefficient[f - g, {x, y, z}], 
    Coefficient[f - g, {x, y, z}] . {x, y, z} - (f - g)], 
   HalfSpace[Coefficient[h - g, {x, y, z}], 
    Coefficient[h - g, {x, y, z}] . {x, y, z} - (h - g)]];
reg3 = RegionIntersection[
   HalfSpace[Coefficient[f - h, {x, y, z}], 
    Coefficient[f - h, {x, y, z}] . {x, y, z} - (f - h)], 
   HalfSpace[Coefficient[g - h, {x, y, z}], 
    Coefficient[g - h, {x, y, z}] . {x, y, z} - (g - h)]];
reg1 = RegionIntersection[reg1, Cuboid[]];
reg2 = RegionIntersection[reg2, Cuboid[]];
reg3 = RegionIntersection[reg3, Cuboid[]];
ConvexRegionQ /@ {reg1, reg2, reg3}
{Region[Style[reg1, Red]], Region[Style[reg2, Green]], 
 Region[Style[reg3, Blue]]}
%//Show
Clear["Global`*"];
{f, g, h} = {{-257, -240, -46, 477}, {-359, -222, 192, 461}, {0, 0, 0,
      0}} . {1, x, y, z};
toSpace = 
  HalfSpace[Coefficient[#, {x, y, z}], 
    Coefficient[#, {x, y, z}] . {x, y, z} - #] &;
reg1 = RegionIntersection[toSpace[g - f], toSpace[h - f]];
reg2 = RegionIntersection[toSpace[f - g], toSpace[h - g]];
reg3 = RegionIntersection[toSpace[f - h], toSpace[g - h]];
{reg1, reg2, reg3} =  
  RegionIntersection[#, Cuboid[]] & /@ {reg1, reg2, reg3};
ConvexRegionQ /@ {reg1, reg2, reg3}
{Region[Style[reg1, Red]], Region[Style[reg2, Green]], 
 Region[Style[reg3, Blue]]}
% // Show
added 1234 characters in body
Source Link
cvgmt
  • 93.6k
  • 6
  • 115
  • 200

Edit

  • Verify my conjecture: The three regions are convex polyhedrons.
Clear["Global`*"];
{f, g, h} = {{-257, -240, -46, 477}, {-359, -222, 192, 461}, {0, 0, 0,
      0}} . {1, x, y, z};
reg1 = RegionIntersection[
   HalfSpace[Coefficient[g - f, {x, y, z}], 
    Coefficient[g - f, {x, y, z}] . {x, y, z} - (g - f)], 
   HalfSpace[Coefficient[h - f, {x, y, z}], 
    Coefficient[h - f, {x, y, z}] . {x, y, z} - (h - f)]];
reg2 = RegionIntersection[
   HalfSpace[Coefficient[f - g, {x, y, z}], 
    Coefficient[f - g, {x, y, z}] . {x, y, z} - (f - g)], 
   HalfSpace[Coefficient[h - g, {x, y, z}], 
    Coefficient[h - g, {x, y, z}] . {x, y, z} - (h - g)]];
reg3 = RegionIntersection[
   HalfSpace[Coefficient[f - h, {x, y, z}], 
    Coefficient[f - h, {x, y, z}] . {x, y, z} - (f - h)], 
   HalfSpace[Coefficient[g - h, {x, y, z}], 
    Coefficient[g - h, {x, y, z}] . {x, y, z} - (g - h)]];
reg1 = RegionIntersection[reg1, Cuboid[]];
reg2 = RegionIntersection[reg2, Cuboid[]];
reg3 = RegionIntersection[reg3, Cuboid[]];
ConvexRegionQ /@ {reg1, reg2, reg3}
{Region[Style[reg1, Red]], Region[Style[reg2, Green]], 
 Region[Style[reg3, Blue]]}
%//Show

{True, True, True}

enter image description here

Edit

  • Verify my conjecture: The three regions are convex polyhedrons.
Clear["Global`*"];
{f, g, h} = {{-257, -240, -46, 477}, {-359, -222, 192, 461}, {0, 0, 0,
      0}} . {1, x, y, z};
reg1 = RegionIntersection[
   HalfSpace[Coefficient[g - f, {x, y, z}], 
    Coefficient[g - f, {x, y, z}] . {x, y, z} - (g - f)], 
   HalfSpace[Coefficient[h - f, {x, y, z}], 
    Coefficient[h - f, {x, y, z}] . {x, y, z} - (h - f)]];
reg2 = RegionIntersection[
   HalfSpace[Coefficient[f - g, {x, y, z}], 
    Coefficient[f - g, {x, y, z}] . {x, y, z} - (f - g)], 
   HalfSpace[Coefficient[h - g, {x, y, z}], 
    Coefficient[h - g, {x, y, z}] . {x, y, z} - (h - g)]];
reg3 = RegionIntersection[
   HalfSpace[Coefficient[f - h, {x, y, z}], 
    Coefficient[f - h, {x, y, z}] . {x, y, z} - (f - h)], 
   HalfSpace[Coefficient[g - h, {x, y, z}], 
    Coefficient[g - h, {x, y, z}] . {x, y, z} - (g - h)]];
reg1 = RegionIntersection[reg1, Cuboid[]];
reg2 = RegionIntersection[reg2, Cuboid[]];
reg3 = RegionIntersection[reg3, Cuboid[]];
ConvexRegionQ /@ {reg1, reg2, reg3}
{Region[Style[reg1, Red]], Region[Style[reg2, Green]], 
 Region[Style[reg3, Blue]]}
%//Show

{True, True, True}

enter image description here

Source Link
cvgmt
  • 93.6k
  • 6
  • 115
  • 200

  • We avoid using Ordering[#,-1] in RegionPlot3D or ContourPlot3D since they seems could not return the Boolean value.
  • We use Max[{a,b,c}]=a, Max[{a,b,c}]=b,Max[{a,b,c}]=c respectively.
F[x_, y_, 
   z_] := {{-257, -240, -46, 477}, {-359, -222, 192, 461}, {0, 0, 0, 
     0}} . {1, x, y, z};
MapThread[
 RegionPlot3D[#2, {x, 0, 1}, {y, 0, 1}, {z, 0, 1}, PlotStyle -> #1, 
   Mesh -> None, Boxed -> False, 
   Lighting -> {{"Ambient", White}}] &, {{Red, Green, Blue}, 
  Thread[Max[F[x, y, z]] == F[x, y, z]]}]
% // Show

enter image description here