Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function movePoint($current_point, $other_points, $mass, $time_interval){
- //Given the above information, this function will return the resulting point after it has been affected by the gravity of the other points.
- /* Basically the method is:
- -Find the distance between the given point, and another of the rest of the points
- -Find the net force experienced by the point
- -Separate net force into the X, Y and Z planes.
- -Repeat steps 1-3, summing up the separated forces.
- -Then, a = G*((m1*m2)/(r^2))/m1
- -I guess that the period is going to affect the velocity, and then displacement... how does it go again. :S
- -s = ut+1/2at^2
- -...I'm going to need more information from the $current_point, I believe. Going to need velocity aswell.
- -shit...
- */
- $net['x'] = 0;
- $net['y'] = 0;
- $net['z'] = 0;
- $dif['x'] = 0;
- $dif['y'] = 0;
- $dif['z'] = 0;
- foreach($other_points as $other){
- //I suck at creating variable names
- //And I didn't really think this through
- if($current_point['x'] != $other['x'] && $current_point['y'] != $other['y'] && $current_point['z'] != $other['x']){
- $dif['x'] = $current_point['x']-$other['x'];
- $dif['y'] = $current_point['y']-$other['y'];
- $dif['z'] = $current_point['z']-$other['z'];
- $distance = sqrt(pow($dif['x'], 2)+pow($dif['y'], 2)+pow($dif['z'], 2)); //Pretty much the radius
- $acceleration = ((6.67300*pow(10, -11)*pow($mass, 2))/pow($distance, 2))/$mass; //I guess that's right
- //now to divide this into the 3 planes - x, y and z
- //Fuck... I'll come back to this tomorrow... Needs more trig.
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment