1 / 6

Gravity simulation

Gravity simulation. Denis Bavčar. Gravity in 2D. 2 large objects which attract other objects N small objects with mass low enough that their influence on other objects can be ignored. Equation in original c++ code: p.vx  += 0.03 * p1.m / (d*d) * (p1.x -  p.x )/d;

Download Presentation

Gravity simulation

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Gravitysimulation Denis Bavčar

  2. Gravity in 2D • 2 large objects which attract other objects • N small objects with mass low enoughthat their influence on other objects can be ignored. • Equation in original c++ code: p.vx += 0.03 * p1.m / (d*d) * (p1.x - p.x)/d; • 0.03 = a constant that replaces G (gravitational constant)in the program • p1.m = mass of the other object • d = distance between two objects • (p1.x – p.x)/d = turns 2D acceleration into horizontal acceleration

  3. Theimportant part of .c code

  4. Kernel

More Related