Center of Gravity Calculation / Calculator
So I’m doing homework, and this center of gravity thing is pretty cool. In Location Strategy they use it to find the best location for stores and such on an X-Y plane with points that have certain weights or populations. “Well that’s neat,” I thought to myself. “I’ll make a little calculator using AJAX and PHP.” Because I really have nothing better to do.
It’s a pretty simple center of gravity calculator, just put in the weights first, seperated by comma’s, then the X coordinates and finally the Y coordinates. You should have the same number of each, if not, well, it’s just wrong. You should get two numbers back, these are the (X,Y) coordinates of the perfect center of gravity.
Enjoy my fancy “Center of Gravity Calculator” that I wasted 25 minutes minutes creating.
Bryan is a jazz and blues guitarist, web designer, teacher, MBA student, Django programmer, entrepreneur, and lover of fine whiskeys. He's the man behind such sites as
great little tool. saved me re-learning the calcs for a quick rough idea of something. thx m8
Thanks a lot
Ok Brian. You are most definitely several magnitudes smarter than I am. I have to ask you a follow up question to this concept of c.g.
I have a homework problem where there is a square and there are four weights hanging from all 4 corners of the square. The weights are (if you are looking at the square in a x,y plane- 1 (at origin), 4 (upper left quadrant), 3 (upper right), and 2 (lower right). The scale on the y axis is from 0 to 2 and the scale on the x axis is from 0 to 2. Where is the center of gravity. Could you help with this and kinda say how you did it. I need your super mathematical powers. If you help you will be elevated to rock star status (and I don’t give this designation out lightly). Oh, and I need it ASAP!
Kris, try entering these in:
w:1,4,3,2
x:0,0,2,2
y:0,2,2,0
Just think in terms of x,y point and weights. At the origin (0,0) with a weight 1. Top left (0,2) is a weight 4. Etc.
Where is this calculator? I dont see where i can use it.
i am trying to find the center of gravity of 4 weights placed along the y-axis
1. 3 kg @ 9.5 meters
2. 2 kg @ 6.4 meters
3. 2.5 kg @ the origin
4. 4 kg @ -.5 meters
Thank you very much ahead of time
Great tool!
Sir, Will you please tell me the main logic behind this cool software.
It will be very useful to me.
Thanking u……….
I use a program called Express CG – located @ expresseng.com\software
Brian,
Good job, now, how can this be used to calculate COG of an athlete?
Jose
Can I have the formula you have sued to calculate Center of Gravity
seena
Used this formula for a customer. Saved me a bunch of time. Hope it is correct! Thank You!
Great PHP – have I found a bug?
Have a problem with a cog of equilateral triangle, so, tried with weights of 1 on each corner, using the base as the x axis & side length of 1 ie weight=1,1,1 x=0,0.5,1 y=0,0.866,0 & the result is 2,289. Where am I going wrong shouldn’t it be 0.5,0.289. When I scale the figures x=0,500,1000 y=0,866,0 the result is correct 500,289?
Great tool. Thanks for sharing.
“Bryan is a jazz and blues guitarist”
Got Roy Rogers?