How do I create a random point on the surface of a cube? [duplicate]
Clash Royale CLAN TAG#URR8PPP
up vote
4
down vote
favorite
This question already has an answer here:
How-to cast a set of random points on the surface of a cuboid?
2 answers
How do I create a random point on the surface of a cube? I mean on one of its six faces at random.
graphics3d random-process
marked as duplicate by Carl Woll, AccidentalFourierTransform, Michael E2, Community⦠Aug 11 at 6:50
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
add a comment |Â
up vote
4
down vote
favorite
This question already has an answer here:
How-to cast a set of random points on the surface of a cuboid?
2 answers
How do I create a random point on the surface of a cube? I mean on one of its six faces at random.
graphics3d random-process
marked as duplicate by Carl Woll, AccidentalFourierTransform, Michael E2, Community⦠Aug 11 at 6:50
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
ListPointPlot3D[RandomSample /@ Transpose[RandomReal[0, 1, 2, 1000]~Join~RandomInteger[0, 1, 1000]], BoxRatios -> 1, 1, 1]
â AccidentalFourierTransform
Aug 10 at 23:47
add a comment |Â
up vote
4
down vote
favorite
up vote
4
down vote
favorite
This question already has an answer here:
How-to cast a set of random points on the surface of a cuboid?
2 answers
How do I create a random point on the surface of a cube? I mean on one of its six faces at random.
graphics3d random-process
This question already has an answer here:
How-to cast a set of random points on the surface of a cuboid?
2 answers
How do I create a random point on the surface of a cube? I mean on one of its six faces at random.
This question already has an answer here:
How-to cast a set of random points on the surface of a cuboid?
2 answers
graphics3d random-process
graphics3d random-process
edited Aug 10 at 18:05
asked Aug 10 at 14:56
mattiav27
2,00411428
2,00411428
marked as duplicate by Carl Woll, AccidentalFourierTransform, Michael E2, Community⦠Aug 11 at 6:50
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
marked as duplicate by Carl Woll, AccidentalFourierTransform, Michael E2, Community⦠Aug 11 at 6:50
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
ListPointPlot3D[RandomSample /@ Transpose[RandomReal[0, 1, 2, 1000]~Join~RandomInteger[0, 1, 1000]], BoxRatios -> 1, 1, 1]
â AccidentalFourierTransform
Aug 10 at 23:47
add a comment |Â
ListPointPlot3D[RandomSample /@ Transpose[RandomReal[0, 1, 2, 1000]~Join~RandomInteger[0, 1, 1000]], BoxRatios -> 1, 1, 1]
â AccidentalFourierTransform
Aug 10 at 23:47
ListPointPlot3D[RandomSample /@ Transpose[RandomReal[0, 1, 2, 1000]~Join~RandomInteger[0, 1, 1000]], BoxRatios -> 1, 1, 1]
â AccidentalFourierTransform
Aug 10 at 23:47
ListPointPlot3D[RandomSample /@ Transpose[RandomReal[0, 1, 2, 1000]~Join~RandomInteger[0, 1, 1000]], BoxRatios -> 1, 1, 1]
â AccidentalFourierTransform
Aug 10 at 23:47
add a comment |Â
3 Answers
3
active
oldest
votes
up vote
3
down vote
accepted
ReplacePart[Table[RandomReal, 3],
RandomChoice[Range[3]] -> RandomInteger[0, 1]]
If you want points on the surface of a $d$-dimensional unit hypercube:
d = 5;
ReplacePart[Table[RandomReal, d],
RandomChoice[Range[d]] -> RandomInteger[0, 1]]
That's a very clever approach!
â Henrik Schumacher
Aug 10 at 20:10
I don't know about faster. Compared toRandomPoint[R, 1000]
, how long does your method take to generate 1000 random points?
â Carl Woll
Aug 10 at 20:36
@David G. Stork. That depends. If you count in the timing for discretizing the region: Yes, this takes a lot if time. But you have to do that only once.
â Henrik Schumacher
Aug 10 at 20:41
You usedTable[RandomPoint[R], 10^6]
instead ofRandomPoint[R, 10^6]
. The latter is about 3 orders of magnitude faster.
â Carl Woll
Aug 10 at 21:46
Ah... you are correct. I'll remove my timing claims.
â David G. Stork
Aug 10 at 22:03
 |Â
show 2 more comments
up vote
5
down vote
We simply need a MeshRegion
that represents the boundary of the unit cube. Then we apply RandomPoint
to it. The following shows one of probably many ways to do it.
R = DiscretizeRegion@RegionBoundary[Cuboid];
RandomPoint[R]
Sorry, not into regions lately, willRegionBoundary
be ok too?RandomPoint[DiscretizeRegion@RegionBoundary@Cuboid, 500]
â Kubaâ¦
Aug 10 at 15:19
@Kuba Ah right! I tried all combinations ofMesh
andBoundary
but forget aboutRegionBoundary
! Thank's for the hint.
â Henrik Schumacher
Aug 10 at 15:26
1
@kirma Yes. What I meant"RegionBoundary@Cuboid
returns a list of quadrilaterals wrapped inPolygon
. Mathematica would have to run planarity checks when callingRandomPoint
. While this would be possible, I can understand that it would not be worthwhile to implement that, in particular since there is already an implementation for simplicialMeshRegion
s. And an automatica conversion would have also its pitfalls. But I agree that I was also puzzled first when I realized thatRandomPoint@RegionBoundary@Cuboid
does not evaluate.
â Henrik Schumacher
Aug 10 at 20:04
2
I believe the need for DiscretizeRegion is a bug, and should be reported. It used to work in 11.1. Also, it works in higher dimensions, e.g.,RandomPoint @ RegionBoundary @ Cuboid[0,0,0,0, 1,1,1,1]
.
â Carl Woll
Aug 10 at 21:53
1
@CarlWoll Okay. I've just sent a report.
â Henrik Schumacher
Aug 10 at 22:02
 |Â
show 4 more comments
up vote
2
down vote
Here is how to build it from scratch in case someone finds that interesting:
coords = 0, 0, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1;
pts = 4, 3, 2, 1, 1, 2, 6, 5, 2, 3, 7, 6, 3, 4, 8, 7, 4, 1, 5, 8, 5, 6, 7, 8;
polygons = Flatten@Normal@GraphicsComplex[coords, Polygon[pts]];
reg = RegionUnion[DiscretizeRegion /@ polygons];
RandomPoint[reg]
I grabbed the coordinates from the documentation for Hexahedron
.
Is it possible to find the coordinates of the point?
â mattiav27
Aug 10 at 15:56
@mattiav27 What do you mean?RandomPoint
returns coordinates.
â C. E.
Aug 10 at 17:57
I didn't know it thanks!
â mattiav27
Aug 10 at 18:04
add a comment |Â
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
3
down vote
accepted
ReplacePart[Table[RandomReal, 3],
RandomChoice[Range[3]] -> RandomInteger[0, 1]]
If you want points on the surface of a $d$-dimensional unit hypercube:
d = 5;
ReplacePart[Table[RandomReal, d],
RandomChoice[Range[d]] -> RandomInteger[0, 1]]
That's a very clever approach!
â Henrik Schumacher
Aug 10 at 20:10
I don't know about faster. Compared toRandomPoint[R, 1000]
, how long does your method take to generate 1000 random points?
â Carl Woll
Aug 10 at 20:36
@David G. Stork. That depends. If you count in the timing for discretizing the region: Yes, this takes a lot if time. But you have to do that only once.
â Henrik Schumacher
Aug 10 at 20:41
You usedTable[RandomPoint[R], 10^6]
instead ofRandomPoint[R, 10^6]
. The latter is about 3 orders of magnitude faster.
â Carl Woll
Aug 10 at 21:46
Ah... you are correct. I'll remove my timing claims.
â David G. Stork
Aug 10 at 22:03
 |Â
show 2 more comments
up vote
3
down vote
accepted
ReplacePart[Table[RandomReal, 3],
RandomChoice[Range[3]] -> RandomInteger[0, 1]]
If you want points on the surface of a $d$-dimensional unit hypercube:
d = 5;
ReplacePart[Table[RandomReal, d],
RandomChoice[Range[d]] -> RandomInteger[0, 1]]
That's a very clever approach!
â Henrik Schumacher
Aug 10 at 20:10
I don't know about faster. Compared toRandomPoint[R, 1000]
, how long does your method take to generate 1000 random points?
â Carl Woll
Aug 10 at 20:36
@David G. Stork. That depends. If you count in the timing for discretizing the region: Yes, this takes a lot if time. But you have to do that only once.
â Henrik Schumacher
Aug 10 at 20:41
You usedTable[RandomPoint[R], 10^6]
instead ofRandomPoint[R, 10^6]
. The latter is about 3 orders of magnitude faster.
â Carl Woll
Aug 10 at 21:46
Ah... you are correct. I'll remove my timing claims.
â David G. Stork
Aug 10 at 22:03
 |Â
show 2 more comments
up vote
3
down vote
accepted
up vote
3
down vote
accepted
ReplacePart[Table[RandomReal, 3],
RandomChoice[Range[3]] -> RandomInteger[0, 1]]
If you want points on the surface of a $d$-dimensional unit hypercube:
d = 5;
ReplacePart[Table[RandomReal, d],
RandomChoice[Range[d]] -> RandomInteger[0, 1]]
ReplacePart[Table[RandomReal, 3],
RandomChoice[Range[3]] -> RandomInteger[0, 1]]
If you want points on the surface of a $d$-dimensional unit hypercube:
d = 5;
ReplacePart[Table[RandomReal, d],
RandomChoice[Range[d]] -> RandomInteger[0, 1]]
edited Aug 10 at 22:03
answered Aug 10 at 18:15
David G. Stork
21.5k11646
21.5k11646
That's a very clever approach!
â Henrik Schumacher
Aug 10 at 20:10
I don't know about faster. Compared toRandomPoint[R, 1000]
, how long does your method take to generate 1000 random points?
â Carl Woll
Aug 10 at 20:36
@David G. Stork. That depends. If you count in the timing for discretizing the region: Yes, this takes a lot if time. But you have to do that only once.
â Henrik Schumacher
Aug 10 at 20:41
You usedTable[RandomPoint[R], 10^6]
instead ofRandomPoint[R, 10^6]
. The latter is about 3 orders of magnitude faster.
â Carl Woll
Aug 10 at 21:46
Ah... you are correct. I'll remove my timing claims.
â David G. Stork
Aug 10 at 22:03
 |Â
show 2 more comments
That's a very clever approach!
â Henrik Schumacher
Aug 10 at 20:10
I don't know about faster. Compared toRandomPoint[R, 1000]
, how long does your method take to generate 1000 random points?
â Carl Woll
Aug 10 at 20:36
@David G. Stork. That depends. If you count in the timing for discretizing the region: Yes, this takes a lot if time. But you have to do that only once.
â Henrik Schumacher
Aug 10 at 20:41
You usedTable[RandomPoint[R], 10^6]
instead ofRandomPoint[R, 10^6]
. The latter is about 3 orders of magnitude faster.
â Carl Woll
Aug 10 at 21:46
Ah... you are correct. I'll remove my timing claims.
â David G. Stork
Aug 10 at 22:03
That's a very clever approach!
â Henrik Schumacher
Aug 10 at 20:10
That's a very clever approach!
â Henrik Schumacher
Aug 10 at 20:10
I don't know about faster. Compared to
RandomPoint[R, 1000]
, how long does your method take to generate 1000 random points?â Carl Woll
Aug 10 at 20:36
I don't know about faster. Compared to
RandomPoint[R, 1000]
, how long does your method take to generate 1000 random points?â Carl Woll
Aug 10 at 20:36
@David G. Stork. That depends. If you count in the timing for discretizing the region: Yes, this takes a lot if time. But you have to do that only once.
â Henrik Schumacher
Aug 10 at 20:41
@David G. Stork. That depends. If you count in the timing for discretizing the region: Yes, this takes a lot if time. But you have to do that only once.
â Henrik Schumacher
Aug 10 at 20:41
You used
Table[RandomPoint[R], 10^6]
instead of RandomPoint[R, 10^6]
. The latter is about 3 orders of magnitude faster.â Carl Woll
Aug 10 at 21:46
You used
Table[RandomPoint[R], 10^6]
instead of RandomPoint[R, 10^6]
. The latter is about 3 orders of magnitude faster.â Carl Woll
Aug 10 at 21:46
Ah... you are correct. I'll remove my timing claims.
â David G. Stork
Aug 10 at 22:03
Ah... you are correct. I'll remove my timing claims.
â David G. Stork
Aug 10 at 22:03
 |Â
show 2 more comments
up vote
5
down vote
We simply need a MeshRegion
that represents the boundary of the unit cube. Then we apply RandomPoint
to it. The following shows one of probably many ways to do it.
R = DiscretizeRegion@RegionBoundary[Cuboid];
RandomPoint[R]
Sorry, not into regions lately, willRegionBoundary
be ok too?RandomPoint[DiscretizeRegion@RegionBoundary@Cuboid, 500]
â Kubaâ¦
Aug 10 at 15:19
@Kuba Ah right! I tried all combinations ofMesh
andBoundary
but forget aboutRegionBoundary
! Thank's for the hint.
â Henrik Schumacher
Aug 10 at 15:26
1
@kirma Yes. What I meant"RegionBoundary@Cuboid
returns a list of quadrilaterals wrapped inPolygon
. Mathematica would have to run planarity checks when callingRandomPoint
. While this would be possible, I can understand that it would not be worthwhile to implement that, in particular since there is already an implementation for simplicialMeshRegion
s. And an automatica conversion would have also its pitfalls. But I agree that I was also puzzled first when I realized thatRandomPoint@RegionBoundary@Cuboid
does not evaluate.
â Henrik Schumacher
Aug 10 at 20:04
2
I believe the need for DiscretizeRegion is a bug, and should be reported. It used to work in 11.1. Also, it works in higher dimensions, e.g.,RandomPoint @ RegionBoundary @ Cuboid[0,0,0,0, 1,1,1,1]
.
â Carl Woll
Aug 10 at 21:53
1
@CarlWoll Okay. I've just sent a report.
â Henrik Schumacher
Aug 10 at 22:02
 |Â
show 4 more comments
up vote
5
down vote
We simply need a MeshRegion
that represents the boundary of the unit cube. Then we apply RandomPoint
to it. The following shows one of probably many ways to do it.
R = DiscretizeRegion@RegionBoundary[Cuboid];
RandomPoint[R]
Sorry, not into regions lately, willRegionBoundary
be ok too?RandomPoint[DiscretizeRegion@RegionBoundary@Cuboid, 500]
â Kubaâ¦
Aug 10 at 15:19
@Kuba Ah right! I tried all combinations ofMesh
andBoundary
but forget aboutRegionBoundary
! Thank's for the hint.
â Henrik Schumacher
Aug 10 at 15:26
1
@kirma Yes. What I meant"RegionBoundary@Cuboid
returns a list of quadrilaterals wrapped inPolygon
. Mathematica would have to run planarity checks when callingRandomPoint
. While this would be possible, I can understand that it would not be worthwhile to implement that, in particular since there is already an implementation for simplicialMeshRegion
s. And an automatica conversion would have also its pitfalls. But I agree that I was also puzzled first when I realized thatRandomPoint@RegionBoundary@Cuboid
does not evaluate.
â Henrik Schumacher
Aug 10 at 20:04
2
I believe the need for DiscretizeRegion is a bug, and should be reported. It used to work in 11.1. Also, it works in higher dimensions, e.g.,RandomPoint @ RegionBoundary @ Cuboid[0,0,0,0, 1,1,1,1]
.
â Carl Woll
Aug 10 at 21:53
1
@CarlWoll Okay. I've just sent a report.
â Henrik Schumacher
Aug 10 at 22:02
 |Â
show 4 more comments
up vote
5
down vote
up vote
5
down vote
We simply need a MeshRegion
that represents the boundary of the unit cube. Then we apply RandomPoint
to it. The following shows one of probably many ways to do it.
R = DiscretizeRegion@RegionBoundary[Cuboid];
RandomPoint[R]
We simply need a MeshRegion
that represents the boundary of the unit cube. Then we apply RandomPoint
to it. The following shows one of probably many ways to do it.
R = DiscretizeRegion@RegionBoundary[Cuboid];
RandomPoint[R]
edited Aug 10 at 15:25
answered Aug 10 at 15:13
Henrik Schumacher
38.2k250110
38.2k250110
Sorry, not into regions lately, willRegionBoundary
be ok too?RandomPoint[DiscretizeRegion@RegionBoundary@Cuboid, 500]
â Kubaâ¦
Aug 10 at 15:19
@Kuba Ah right! I tried all combinations ofMesh
andBoundary
but forget aboutRegionBoundary
! Thank's for the hint.
â Henrik Schumacher
Aug 10 at 15:26
1
@kirma Yes. What I meant"RegionBoundary@Cuboid
returns a list of quadrilaterals wrapped inPolygon
. Mathematica would have to run planarity checks when callingRandomPoint
. While this would be possible, I can understand that it would not be worthwhile to implement that, in particular since there is already an implementation for simplicialMeshRegion
s. And an automatica conversion would have also its pitfalls. But I agree that I was also puzzled first when I realized thatRandomPoint@RegionBoundary@Cuboid
does not evaluate.
â Henrik Schumacher
Aug 10 at 20:04
2
I believe the need for DiscretizeRegion is a bug, and should be reported. It used to work in 11.1. Also, it works in higher dimensions, e.g.,RandomPoint @ RegionBoundary @ Cuboid[0,0,0,0, 1,1,1,1]
.
â Carl Woll
Aug 10 at 21:53
1
@CarlWoll Okay. I've just sent a report.
â Henrik Schumacher
Aug 10 at 22:02
 |Â
show 4 more comments
Sorry, not into regions lately, willRegionBoundary
be ok too?RandomPoint[DiscretizeRegion@RegionBoundary@Cuboid, 500]
â Kubaâ¦
Aug 10 at 15:19
@Kuba Ah right! I tried all combinations ofMesh
andBoundary
but forget aboutRegionBoundary
! Thank's for the hint.
â Henrik Schumacher
Aug 10 at 15:26
1
@kirma Yes. What I meant"RegionBoundary@Cuboid
returns a list of quadrilaterals wrapped inPolygon
. Mathematica would have to run planarity checks when callingRandomPoint
. While this would be possible, I can understand that it would not be worthwhile to implement that, in particular since there is already an implementation for simplicialMeshRegion
s. And an automatica conversion would have also its pitfalls. But I agree that I was also puzzled first when I realized thatRandomPoint@RegionBoundary@Cuboid
does not evaluate.
â Henrik Schumacher
Aug 10 at 20:04
2
I believe the need for DiscretizeRegion is a bug, and should be reported. It used to work in 11.1. Also, it works in higher dimensions, e.g.,RandomPoint @ RegionBoundary @ Cuboid[0,0,0,0, 1,1,1,1]
.
â Carl Woll
Aug 10 at 21:53
1
@CarlWoll Okay. I've just sent a report.
â Henrik Schumacher
Aug 10 at 22:02
Sorry, not into regions lately, will
RegionBoundary
be ok too?RandomPoint[DiscretizeRegion@RegionBoundary@Cuboid, 500]
â Kubaâ¦
Aug 10 at 15:19
Sorry, not into regions lately, will
RegionBoundary
be ok too?RandomPoint[DiscretizeRegion@RegionBoundary@Cuboid, 500]
â Kubaâ¦
Aug 10 at 15:19
@Kuba Ah right! I tried all combinations of
Mesh
and Boundary
but forget about RegionBoundary
! Thank's for the hint.â Henrik Schumacher
Aug 10 at 15:26
@Kuba Ah right! I tried all combinations of
Mesh
and Boundary
but forget about RegionBoundary
! Thank's for the hint.â Henrik Schumacher
Aug 10 at 15:26
1
1
@kirma Yes. What I meant"
RegionBoundary@Cuboid
returns a list of quadrilaterals wrapped in Polygon
. Mathematica would have to run planarity checks when calling RandomPoint
. While this would be possible, I can understand that it would not be worthwhile to implement that, in particular since there is already an implementation for simplicial MeshRegion
s. And an automatica conversion would have also its pitfalls. But I agree that I was also puzzled first when I realized that RandomPoint@RegionBoundary@Cuboid
does not evaluate.â Henrik Schumacher
Aug 10 at 20:04
@kirma Yes. What I meant"
RegionBoundary@Cuboid
returns a list of quadrilaterals wrapped in Polygon
. Mathematica would have to run planarity checks when calling RandomPoint
. While this would be possible, I can understand that it would not be worthwhile to implement that, in particular since there is already an implementation for simplicial MeshRegion
s. And an automatica conversion would have also its pitfalls. But I agree that I was also puzzled first when I realized that RandomPoint@RegionBoundary@Cuboid
does not evaluate.â Henrik Schumacher
Aug 10 at 20:04
2
2
I believe the need for DiscretizeRegion is a bug, and should be reported. It used to work in 11.1. Also, it works in higher dimensions, e.g.,
RandomPoint @ RegionBoundary @ Cuboid[0,0,0,0, 1,1,1,1]
.â Carl Woll
Aug 10 at 21:53
I believe the need for DiscretizeRegion is a bug, and should be reported. It used to work in 11.1. Also, it works in higher dimensions, e.g.,
RandomPoint @ RegionBoundary @ Cuboid[0,0,0,0, 1,1,1,1]
.â Carl Woll
Aug 10 at 21:53
1
1
@CarlWoll Okay. I've just sent a report.
â Henrik Schumacher
Aug 10 at 22:02
@CarlWoll Okay. I've just sent a report.
â Henrik Schumacher
Aug 10 at 22:02
 |Â
show 4 more comments
up vote
2
down vote
Here is how to build it from scratch in case someone finds that interesting:
coords = 0, 0, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1;
pts = 4, 3, 2, 1, 1, 2, 6, 5, 2, 3, 7, 6, 3, 4, 8, 7, 4, 1, 5, 8, 5, 6, 7, 8;
polygons = Flatten@Normal@GraphicsComplex[coords, Polygon[pts]];
reg = RegionUnion[DiscretizeRegion /@ polygons];
RandomPoint[reg]
I grabbed the coordinates from the documentation for Hexahedron
.
Is it possible to find the coordinates of the point?
â mattiav27
Aug 10 at 15:56
@mattiav27 What do you mean?RandomPoint
returns coordinates.
â C. E.
Aug 10 at 17:57
I didn't know it thanks!
â mattiav27
Aug 10 at 18:04
add a comment |Â
up vote
2
down vote
Here is how to build it from scratch in case someone finds that interesting:
coords = 0, 0, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1;
pts = 4, 3, 2, 1, 1, 2, 6, 5, 2, 3, 7, 6, 3, 4, 8, 7, 4, 1, 5, 8, 5, 6, 7, 8;
polygons = Flatten@Normal@GraphicsComplex[coords, Polygon[pts]];
reg = RegionUnion[DiscretizeRegion /@ polygons];
RandomPoint[reg]
I grabbed the coordinates from the documentation for Hexahedron
.
Is it possible to find the coordinates of the point?
â mattiav27
Aug 10 at 15:56
@mattiav27 What do you mean?RandomPoint
returns coordinates.
â C. E.
Aug 10 at 17:57
I didn't know it thanks!
â mattiav27
Aug 10 at 18:04
add a comment |Â
up vote
2
down vote
up vote
2
down vote
Here is how to build it from scratch in case someone finds that interesting:
coords = 0, 0, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1;
pts = 4, 3, 2, 1, 1, 2, 6, 5, 2, 3, 7, 6, 3, 4, 8, 7, 4, 1, 5, 8, 5, 6, 7, 8;
polygons = Flatten@Normal@GraphicsComplex[coords, Polygon[pts]];
reg = RegionUnion[DiscretizeRegion /@ polygons];
RandomPoint[reg]
I grabbed the coordinates from the documentation for Hexahedron
.
Here is how to build it from scratch in case someone finds that interesting:
coords = 0, 0, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1;
pts = 4, 3, 2, 1, 1, 2, 6, 5, 2, 3, 7, 6, 3, 4, 8, 7, 4, 1, 5, 8, 5, 6, 7, 8;
polygons = Flatten@Normal@GraphicsComplex[coords, Polygon[pts]];
reg = RegionUnion[DiscretizeRegion /@ polygons];
RandomPoint[reg]
I grabbed the coordinates from the documentation for Hexahedron
.
answered Aug 10 at 15:28
C. E.
47.7k391193
47.7k391193
Is it possible to find the coordinates of the point?
â mattiav27
Aug 10 at 15:56
@mattiav27 What do you mean?RandomPoint
returns coordinates.
â C. E.
Aug 10 at 17:57
I didn't know it thanks!
â mattiav27
Aug 10 at 18:04
add a comment |Â
Is it possible to find the coordinates of the point?
â mattiav27
Aug 10 at 15:56
@mattiav27 What do you mean?RandomPoint
returns coordinates.
â C. E.
Aug 10 at 17:57
I didn't know it thanks!
â mattiav27
Aug 10 at 18:04
Is it possible to find the coordinates of the point?
â mattiav27
Aug 10 at 15:56
Is it possible to find the coordinates of the point?
â mattiav27
Aug 10 at 15:56
@mattiav27 What do you mean?
RandomPoint
returns coordinates.â C. E.
Aug 10 at 17:57
@mattiav27 What do you mean?
RandomPoint
returns coordinates.â C. E.
Aug 10 at 17:57
I didn't know it thanks!
â mattiav27
Aug 10 at 18:04
I didn't know it thanks!
â mattiav27
Aug 10 at 18:04
add a comment |Â
ListPointPlot3D[RandomSample /@ Transpose[RandomReal[0, 1, 2, 1000]~Join~RandomInteger[0, 1, 1000]], BoxRatios -> 1, 1, 1]
â AccidentalFourierTransform
Aug 10 at 23:47