0

This is a followup to this question of mine.

How do I generate a random point on the most external surface of this complex geometry?

pts = {{-0.5, -0.5, -0.5}, {-0.5, 0.5, -0.5}, {-0.5, 0.5, 
    0.5}, {-0.5, -0.5, 0.5}, {0.5, -0.5, -0.5}, {0.5, 
    0.5, -0.5}, {0.5, 0.5, 0.5}, {0.5, -0.5, 0.5}};
pts1 = ScalingTransform[{4.6, 4.6, 4.6}][pts]; pts2 = 
 ScalingTransform[{4.9, 4.9, 4.9}][pts];
pts3 = ScalingTransform[{4.903, 4.903, 4.903}][pts];
hex = {{2, 3, 4, 1}, {1, 4, 8, 5}, {4, 3, 7, 8}, {3, 2, 6, 7}, {2, 1, 
    5, 6}, {5, 8, 7, 6}};
r1 = BoundaryMeshRegion[Join[pts1], Polygon[hex], 
   MeshCellStyle -> Opacity[0.2]];
r2 = BoundaryMeshRegion[Join[pts2, pts3], Polygon[hex], 
   Polygon[hex + 8], MeshCellStyle -> Opacity[0.2]];

Show[r1, r2]

enter image description here

Please remember I use version 10, where RandomPoint is not available

mattiav27
  • 6,677
  • 3
  • 28
  • 64

1 Answers1

0
ReplacePart[Table[RandomReal[{-2.45, 2.45}], 3], 
 RandomChoice[Range[3]] -> RandomChoice[{-2.45, 2.45}]]

(*

{-2.45, -2.15682, 1.28829}

*)

David G. Stork
  • 41,180
  • 3
  • 34
  • 96