Skip to main content
added 368 characters in body
Source Link
cvgmt
  • 84.1k
  • 6
  • 97
  • 179

Update

I found an example to show the limitation of RegionIntersection.

reg = RegionIntersection[Circle[{0, 0}, {5, 4}], 
   Circle[{0, 0}, {2, 8}]];
(* EmptyRegion[2] *)
RandomPoint[reg]
dreg = RegionIntersection[DiscretizeRegion@Circle[{0, 0}, {5, 4}], 
   DiscretizeRegion@Circle[{0, 0}, {2, 8}]];
RandomPoint[dreg]

RandomPoint[EmptyRegion[2]]

{-1.76789, 3.73945}

Original

Maybe ConicHullRegion is numeric and Sphere is symbolic, so they need to coordinate. The last result seems depend on the structure of discretize region.

SeedRandom[1];
BooleanRegion[#1 && ! #2 &, {Sphere[{0, 0, 0}], 
   Line[{{0, 0, 0}, {1, 1, 1}}]}] // RandomPoint
RegionDifference[Sphere[], 
  Triangle[{{0, 0, 0}, {1, 1, 1}, {2, 1, 1}}]] // RandomPoint
RegionDifference[Sphere[], 
   ConicHullRegion[{{0, 0, 0}}, {{1, 1, 1}, {2, 1, 1}}]] // 
  DiscretizeRegion // RandomPoint

{0.245529, -0.968234, 0.0473094}

{-0.528872, 0.54312, -0.652162}

Maybe ConicHullRegion is numeric and Sphere is symbolic, so they need to coordinate. The last result seems depend on the structure of discretize region.

SeedRandom[1];
BooleanRegion[#1 && ! #2 &, {Sphere[{0, 0, 0}], 
   Line[{{0, 0, 0}, {1, 1, 1}}]}] // RandomPoint
RegionDifference[Sphere[], 
  Triangle[{{0, 0, 0}, {1, 1, 1}, {2, 1, 1}}]] // RandomPoint
RegionDifference[Sphere[], 
   ConicHullRegion[{{0, 0, 0}}, {{1, 1, 1}, {2, 1, 1}}]] // 
  DiscretizeRegion // RandomPoint

{0.245529, -0.968234, 0.0473094}

{-0.528872, 0.54312, -0.652162}

Update

I found an example to show the limitation of RegionIntersection.

reg = RegionIntersection[Circle[{0, 0}, {5, 4}], 
   Circle[{0, 0}, {2, 8}]];
(* EmptyRegion[2] *)
RandomPoint[reg]
dreg = RegionIntersection[DiscretizeRegion@Circle[{0, 0}, {5, 4}], 
   DiscretizeRegion@Circle[{0, 0}, {2, 8}]];
RandomPoint[dreg]

RandomPoint[EmptyRegion[2]]

{-1.76789, 3.73945}

Original

Maybe ConicHullRegion is numeric and Sphere is symbolic, so they need to coordinate. The last result seems depend on the structure of discretize region.

SeedRandom[1];
BooleanRegion[#1 && ! #2 &, {Sphere[{0, 0, 0}], 
   Line[{{0, 0, 0}, {1, 1, 1}}]}] // RandomPoint
RegionDifference[Sphere[], 
  Triangle[{{0, 0, 0}, {1, 1, 1}, {2, 1, 1}}]] // RandomPoint
RegionDifference[Sphere[], 
   ConicHullRegion[{{0, 0, 0}}, {{1, 1, 1}, {2, 1, 1}}]] // 
  DiscretizeRegion // RandomPoint

{0.245529, -0.968234, 0.0473094}

{-0.528872, 0.54312, -0.652162}

added 128 characters in body
Source Link
cvgmt
  • 84.1k
  • 6
  • 97
  • 179

Maybe ConicHullRegion is numeric and Sphere is symbolic, so they need to coordinate. The last result seems depend on the structure of discretize region.

SeedRandom[1];
BooleanRegion[#1 && ! #2 &, {Sphere[{0, 0, 0}], 
   Line[{{0, 0, 0}, {1, 1, 1}}]}] // RandomPoint
RegionDifference[Sphere[], 
  Triangle[{{10, 0, 0}, {01, 1, 01}, {2, 1, 1}}]] // RandomPoint
RegionDifference[Sphere[], 
   ConicHullRegion[{{0, 0, 0}}, {{1, 1, 1}, {2, 1, 1}}]] // 
  DiscretizeRegion // RandomPoint 

{0.245529, -0.968234, 0.0473094}

{-0.528872, 0.54312, -0.652162}

Maybe ConicHullRegion is numeric and Sphere is symbolic, so they need to coordinate.

SeedRandom[1];
BooleanRegion[#1 && ! #2 &, {Sphere[{0, 0, 0}], 
   Line[{{0, 0, 0}, {1, 1, 1}}]}] // RandomPoint
RegionDifference[Sphere[], 
  Triangle[{{1, 0, 0}, {0, 1, 0}, {0, 0, 1}}]] // RandomPoint

{0.245529, -0.968234, 0.0473094}

{-0.528872, 0.54312, -0.652162}

Maybe ConicHullRegion is numeric and Sphere is symbolic, so they need to coordinate. The last result seems depend on the structure of discretize region.

SeedRandom[1];
BooleanRegion[#1 && ! #2 &, {Sphere[{0, 0, 0}], 
   Line[{{0, 0, 0}, {1, 1, 1}}]}] // RandomPoint
RegionDifference[Sphere[], 
  Triangle[{{0, 0, 0}, {1, 1, 1}, {2, 1, 1}}]] // RandomPoint
RegionDifference[Sphere[], 
   ConicHullRegion[{{0, 0, 0}}, {{1, 1, 1}, {2, 1, 1}}]] // 
  DiscretizeRegion // RandomPoint 

{0.245529, -0.968234, 0.0473094}

{-0.528872, 0.54312, -0.652162}

added 129 characters in body
Source Link
cvgmt
  • 84.1k
  • 6
  • 97
  • 179

Maybe ConicHullRegion is numeric and Sphere is symbolic, so they need to coordinate.

SeedRandom[1];
BooleanRegion[#1 && ! #2 &, {Sphere[{0, 0, 0}], 
   Line[{{0, 0, 0}, {1, 1, 1}}]}] // RandomPoint
RegionDifference[Sphere[], 
  Triangle[{{1, 0, 0}, {0, 1, 0}, {0, 0, 1}}]] // RandomPoint

{0.245529, -0.968234, 0.0473094}

{-0.528872, 0.54312, -0.652162}

Maybe ConicHullRegion is numeric and Sphere is symbolic, so they need to coordinate.

SeedRandom[1];
BooleanRegion[#1 && ! #2 &, {Sphere[{0, 0, 0}], 
   Line[{{0, 0, 0}, {1, 1, 1}}]}] // RandomPoint

{0.245529, -0.968234, 0.0473094}

Maybe ConicHullRegion is numeric and Sphere is symbolic, so they need to coordinate.

SeedRandom[1];
BooleanRegion[#1 && ! #2 &, {Sphere[{0, 0, 0}], 
   Line[{{0, 0, 0}, {1, 1, 1}}]}] // RandomPoint
RegionDifference[Sphere[], 
  Triangle[{{1, 0, 0}, {0, 1, 0}, {0, 0, 1}}]] // RandomPoint

{0.245529, -0.968234, 0.0473094}

{-0.528872, 0.54312, -0.652162}

Source Link
cvgmt
  • 84.1k
  • 6
  • 97
  • 179
Loading