Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9047211
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T11:51:18+00:00 2026-06-16T11:51:18+00:00

I am trying to generate vectors equidistant from a point at the centre of

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T11:51:19+00:00Added an answer on June 16, 2026 at 11:51 am

    Do you care about the pdf (probability dristribution) of the angles? By generating uniformly-distributed random points in a cube, you will tend to favor the directions of the cube’s corners. This is obviously different from sampling random points on the surface of a sphere.

    If you want a uniform distribution on the surface of a sphere, try e.g. Sphere Point Picking (basically, generate angles independently, instead of x-y-z coordinates)

    As far as moving the sphere from the origin to a different point, that is just a matter of adding constants to your end result (x-y-z coordinates computed from polar coordinates), as others have pointed out.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to generate 16 000 000 unique random numbers (10-digits: range 1 000
i'm trying to generate permutations from a part of a vector. See below. vector<int>
Im trying to generate a color gradient using ColdFusion. My current code below works
I'm trying to generate the following html code using cl-who: <html> <body> <div id=cnt_1></div>
I am trying to generate N random x values to pass to a charting
I'm trying to generate a vector graphic from an area in a bitmap image,
I am trying to generate an array from some starting values using this formula
I'm using numpy 1.6 and matplotlib 1.1.1, trying to generate a velocity field from
I am trying to generate a series of auditory spikes from a sampled signal
I'm trying to generate a grid layout from a repeat control. Inside the repeat

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.