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 7771743
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T16:43:32+00:00 2026-06-01T16:43:32+00:00

I would like to create a Gravity Grid such as in this image: The

  • 0

I would like to create a “Gravity Grid” such as in this image:

img

The closest I have been in creating this grid is shown in this image:

img2

I’m only warping the lines parallel to the Y-Axis until I can solve this problem. But as you can see in the picture, the lines seem to be warping past my “planet”.

Here is the code of interest I have for now:

for (each point on a line parallel to the y-axis) {
    if (planetPosition.x > currrentPoint.x) {
        warpedXPos = currrentPoint.x + (1 / (distance*1000));
    }
    else {
        warpedXPos = currrentPoint.x - (1 / (distance*1000));
    }
}
  • 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-01T16:43:33+00:00Added an answer on June 1, 2026 at 4:43 pm

    The idea is to pull every point towards the planet by an amount proportional to 1/R, where R is the distance from the planet to the point.

    In your code you currentPoint.x, etc, is the absolute position, but you need to warp the position relative to the planet. Therefore your equation should look like:

    warped.x = currrentPoint.x + (planetPosition.x-currrentPoint.x)/(1000*distance)
    

    The part after the + is the scaling of the relative distance basically your warp, and then you add this deflection to the original absolute value. You probably also won’t want to use the 1000 factor, but this is just keeping with your example. Also, note that there’s no need to break this into cases using the >, the sign of the subtraction should make the adjustment in the appropriate direction.

    (By the way, this type of operation is super common… first you subtract an absolute factor, then you scale, then you add the original factor back in. It’s a trick worth memorizing for use in lots of applications.)

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

Sidebar

Related Questions

i would like create a array of structure which have a dynamic array :
I would like create same as on stackoverflow - orange comunnicates, but i have
I would like create a custom DataRow that will have -let's say- a propery
I have a model, I would like create a thumbnail by ImageMagick( yes with
I would like to create a macro as such: <macrodef name=testing> <element name=test implicit=yes/>
I would like to create a main overview chart with asp:chart control, like this:
I would like to create a 5-by-5 grid of tabulate twoway frequency count tables,
i would like create a menu with kdialog like this kdialog --menu choose your
I would like create a MVC3 website. I have existing dlls packaged as .net
I would like to create a layout for an android application where I have

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.