I am trying to generate vectors equidistant from a point at the centre of the screen.
Previously, I was following the below approach 1. Generate random numbers Random(0-400, 0+400) for x, y and z
2. Normalize the vectors
3. Scale them to whatever distance wanted
However, this was when my origin was at 0. Now, that I have to do something like this from the centre of the screen. I tried to go with the following approach, and this for some reason is giving me x and y only in the positive quadrant (z comes out to be fine)
//Origin (midpointX of screen, midPointY of screen, z=0) //vector<Vec3f> positions; //positions.push_back(getPoint().scale(300); getPoint{ Vec3f rVector; rVector.set( Random(midPointX-100,midPointX+100), Random(midPointY-100,midPointY+100), Random(0-100,0+100) ); } Assume all these points on lie on the sirface of a sphere of some radius. Hence, these are equidistant from the centre(x,y,z). It would be great to know of a better approach to generate these points.
I am fine with the algorithm only.