PDA

View Full Version : 3D Poisson distribution



alexxi
09-26-2015, 07:59 PM
Is it possible to use C++'s poisson_distribution to sample 3D points within an axis- aligned cube?

wmelgaard
09-29-2015, 12:28 PM
I don't understand what you are trying to do.
Are you using a random number generator with a poisson distribution to pick points off an OpenGL cube?
Or are you plotting points within that cube?

alexxi
09-29-2015, 09:04 PM
I don't understand what you are trying to do.
Are you using a random number generator with a poisson distribution to pick points off an OpenGL cube?
Or are you plotting points within that cube?

I am plotting points within that cube.

wmelgaard
09-30-2015, 05:40 AM
Assume that your box is bounded by [0,0,0; 0,0,1; 0,1,0; 0,1,1; 1,0,1; 1,1,1]. Compute your point [x,y,z] where (0 <= x <= 1); (0 <= y <= 1); (0 <= z <= 1) and plot your point within your cube.
glBegin(GL_POINTS);
glVertex3f(x, y, z);
glEnd();
repeat as required. You may need to increase your point size, since the default is one pixel, which is almost invisible.

Problem (as presented) is complete. However, viewing the result is a major problem, since your window is in 2D. One solution is to vary the color. E.g.
glColor3f(x, y, z);
Another solution is to wiggle your plotted cube, which would give an illusion of depth.
Another solution would be to vary the plotted point size with depth, with the largest points being the closest. The greater your hardware resolution, the more effective this will be.
Of course if you have a 3D monitor, the problem goes away. (smiley face).


I am plotting points within that cube.