Newtons second law

I’m trying (and failing high school maths) to work out how to apply gravity to two xojo.point objects. This is how far I have got.

Created two points
dim v1 as new Xojo.Core.Point(x,y)
dim v2 as new Xojo.Core.Point(x1,y1)

worked out the distance between then
dim distance as double=v1.DistanceTo(v2)

worked out the angle in relation to them
dim angle as double=(((atan2(y1 - y, x1 - x)) * 180 )/ 3.14159265)

ok this is where it goes wrong ( i think , i,m guessing i need two forces ? )

dim force as double = log(distance*mass) ’ Think I should be using inverse log here, but I cant find a log10 function in Xojo

then i apply the calculation

Any mathematical wizards out there want to take up the challenge… I’ve looked at ABPE and could not work out if he was actually using NL.

func Log10(x as double) as double
return log(x)/log(10)
end function

What Xojo defines as LOG is the Natural Log, elsewhere designated as “ln” or “log2”

What is the mass?
Seems to be uninitialised and therefore zero

Force = mass*acceleration

you were correct to remove the *0.017xx as your were already stating ANGLE as radians.
however, and I haven’t checked… but are you sure you don’t have this inverted?

dim angle as double=(((atan2(y1 - y, x1 - x)) * 180 )/ 3.14159265)

or do you even need the 180 and Pi? since Atan2 is also radians

dim angle as double=atan2(y1 - y, x1 - x)

Not sure exactly what you’re trying to calculate. If it’s gravitational force, then I don’t know how the log() function manages to get in there. The gravitational force between two objects is simply:
g is the gravitational constant 6.674e-11 (SI units)
m1 and m2 are the masses of the objects,
r is the distance separating them,
The direction of the force is the direction of the line joining the two points. So the angle ? is given as:
? = atan2(p1y-p2y,p1x-p2x)
where p1x,p1y,p2x and p2y are the x and y coordinates of points p1 and p2.
Once you know force, then acceleration is given by:
where F is force, m is the mass of the object, and a is acceleration.
To convert the acceleration into separate x and y components you use the standard trigonometric conversions.
ay=a sin(?)
ax=a cos(?)

Adding to Robert’s post:

And to calculate the new position and velocity of the objects you have to take into account their current velocity.

I may not be understanding properly what you are doing though.