How to plot a random points on the Cuboid?

Graphics3D[{Yellow, Opacity[0.3], Cuboid[{0, 0, 0}, {1, 3, 1}]}, Boxed -> False]

enter image description here

And how can I use FindShortestTour for the given random points on the cuboid?

It's easy to generate random points and use FindShortestTour inside cuboid

pts = RandomPoint[Cuboid[{0, 0, 0}, {1, 3, 1}], 500];
Graphics3D[{Blue, PointSize[Medium], Point[pts]}]

enter image description here

PointSize[Medium], Blue, Point[pts]}]

enter image description here

but I need to generate random points on the cuboid surface

  • $\begingroup$ So not plot but to generate, and you mean cuboid surface? $\endgroup$ – Kuba Dec 23 '16 at 8:40
  • $\begingroup$ @Kuba yes, I mean cuboid surface.. $\endgroup$ – vito Dec 23 '16 at 8:52
  • $\begingroup$ It comes down to finding a distance function on the surface of the cuboid, so it might be a good idea to first ask on math.SE how to define the distance function. $\endgroup$ – C. E. Dec 23 '16 at 9:39
  • 2
    $\begingroup$ Use RegionBoundary to get the cuboid surface $\endgroup$ – Simon Woods Dec 23 '16 at 9:50
  • 1
    $\begingroup$ For generating random points on a cuboid's surface, see this earlier question; however, as C.E. says, you'll need to define what would be the distance of, say, two points on opposing faces of a cuboid. $\endgroup$ – J. M. will be back soon Dec 23 '16 at 11:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.