Jakotheshadows
New member
- Joined
- Jun 29, 2008
- Messages
- 47
I am writing a c++ program, and am stumbling over one of the functions I am trying to write.
The problem is that I have two 2 dimensional circles that lie on a cartesian plane and each circle has a mass.
With the center coordinates and mass for each circle, I want to return a combined center to my main function.
I have found a formula for the distance from the center of the first body to the barycenter, but I can not for the life of me figure out how to get (x,y) coordinates out of that distance.
barycenter formula:
r = a * ( massTwo / (massOne + massTwo)
where r is the distance from the first body to the barycenter and a is the distance between the centers of each body
I am capable of getting an equation of the line between the centers. I just need to compute the x and y coordinates of the barycenter. Any advice appreciated.
The problem is that I have two 2 dimensional circles that lie on a cartesian plane and each circle has a mass.
With the center coordinates and mass for each circle, I want to return a combined center to my main function.
I have found a formula for the distance from the center of the first body to the barycenter, but I can not for the life of me figure out how to get (x,y) coordinates out of that distance.
barycenter formula:
r = a * ( massTwo / (massOne + massTwo)
where r is the distance from the first body to the barycenter and a is the distance between the centers of each body
I am capable of getting an equation of the line between the centers. I just need to compute the x and y coordinates of the barycenter. Any advice appreciated.