Formula/Algorithm to apply force to an arbitrary point on a polygon

Click For Summary

Discussion Overview

The discussion revolves around the challenges of implementing a 2D rigid body physics engine in Java, specifically focusing on how to calculate the linear and rotational acceleration of an object when a force is applied at an arbitrary point on a polygon. Participants explore various aspects of force application, torque, and the relationship between linear and angular accelerations.

Discussion Character

  • Exploratory
  • Technical explanation
  • Debate/contested
  • Mathematical reasoning

Main Points Raised

  • One participant expresses difficulty in determining how an object moves and rotates when a force is applied off-center.
  • Another participant references Newton's laws and discusses the independence of linear and angular accelerations.
  • Some participants propose that the ratio of linear to angular acceleration depends on mass distribution and the distance from the center of mass, while others argue that there is no such ratio.
  • A participant describes a method of calculating the effect of force on the center of gravity and obtaining torque through the cross product of the radius and force.
  • Concerns are raised about the behavior of a circular object when force is applied at different points, questioning whether it results in the same linear acceleration.
  • One participant notes that their simulation does not match real-life observations, prompting questions about the correctness of their calculations.
  • Another participant suggests reducing the moment of inertia to achieve more spinning in the simulation.
  • One participant identifies an issue with unit conversion in their simulation, which they believe affected the results.

Areas of Agreement / Disagreement

Participants express differing views on the relationship between linear and angular accelerations, with some asserting independence while others suggest a dependency based on force application. The discussion remains unresolved regarding the precise calculations and behaviors expected in the simulation.

Contextual Notes

Participants mention limitations related to the moment of inertia, unit conversions, and the specific implementation of force vectors in a 2D context. There are unresolved questions about the accuracy of the simulation compared to real-world behavior.

MTK
Messages
13
Reaction score
0
I am trying to code a 2D rigid body physics engine in Java, and I am having some trouble figuring out how an object will move and rotate if the force is off-center.

Basically, what I can't seem to figure out is a way to find out the x, y, and rotational acceleration when a force is applied at an arbitrary point on an arbitrary polygon. I tried searching, but there were only something like 2-3 relavent results, and I couldn't really understand them well.
 
Physics news on Phys.org
I found this:

http://en.wikipedia.org/wiki/File:Torque,_position,_and_force.svg

So from this I understand that if the force is all parallel, then there is no rotation and all acceleration is linear, and if it is all perpendicular, then the linear/angular ratio depends somehow on the mass, mass distribution, and how far from the center of mass the force is applied.
 
So I made it that only the component of the force vector that is parallel with the coener of mass causes linear acceleration.

But I still don't know how to tell the ratio of linear to angular acceleration caused by the perpendicular component, and how to know how much torque is produced.
 
MTK said:
and if it is all perpendicular, then the linear/angular ratio depends somehow on the mass, mass distribution, and how far from the center of mass the force is applied.
There is no linear/angular ratio. The instantaneous linear/angular accelerations are independent.
 
Then how do you explain this?
 

Attachments

  • Screenshot.png
    Screenshot.png
    3.7 KB · Views: 492
MTK said:
Then how do you explain this?
Both forces produce the same instantaneous linear acceleration, but different instantaneous angular accelerations.
 
So, for example, if I have a circular object, and I apply a force right on the edge (like a tangent on the egde of the circle), will that apply just as much linear acceleration as pushing the circle right in the middle?
 
When you apply a force to an object, be it a polygon or otherwise, you do two calculations:

1. Apply the force to the center-of-gravity (COG)
2. Take the cross product of the radius to the point of application, with the force, to obtain the torque

Why, you might ask? Think of the object as a system of separate particles. When you apply a force to a particle that is offset from the COG (of the system!), immediately that particle wants to tug away at F / (mass of the particle). However, since it's linked to all the other particles in your object, you get this system of internal forces - the particle pulls on the system, and the system pulls back. Your input force is therefore distributed to all the particles in the system, through their constraints.

The rotation is a totally different game. It's the effect that your force has on the orientation of the system - but torque-induced rotation is caused entirely by INTERNAL forces. Thus, if you start dividing your torque into perpendicular/parallel components, you're actually throwing away some of the input force.
 
  • #10
MTK said:
So, for example, if I have a circular object, and I apply a force right on the edge (like a tangent on the egde of the circle), will that apply just as much linear acceleration as pushing the circle right in the middle?
Yes.
 
  • #11
But my Vector class is 2D, but it appears that the cross product must be 3D. But when to think of it, only the Z axis could be perpendicular to the x, y plane, so can I just calculate the Z axis and ignore X and Y?

And how exactly do you convert a 3D vector into a scalar rotation value?
 
  • #12
MTK said:
But my Vector class is 2D, but it appears that the cross product must be 3D. But when to think of it, only the Z axis could be perpendicular to the x, y plane, so can I just calculate the Z axis and ignore X and Y?
XY of the cross product will be zero anyway if Z=0 in both input vectors
MTK said:
And how exactly do you convert a 3D vector into a scalar rotation value?
Generally you take the norm, but here it is just Z.
 
  • #13
I am still wondering if this is all correct, because if I apply force to the edge of an object in my simulation, it accelerates sideways, but hardly spins at all. This is nothing like what I observe in real life or this applet:

http://www.myphysicslab.com/collision.html

And these are my formulas:

velocity = velocity.add(force.scale(1/mass))
dt += offset.crossProduct(force) / momentOfInertia

(dt is the angular velocity, in radians per second)
 
  • #14
MTK said:
I am still wondering if this is all correct, because if I apply force to the edge of an object in my simulation, it accelerates sideways, but hardlt spins at all.
Reduce the moment of Inertia if you want it to spin more. How is your force determined? Does the force direction rotate with the object, or does it always point in the same direction?
 
  • #15
I figured out the problem, I forgot to convert meters to pixels and seconds to frames in a few places.

Now the simulation feels much more correct.
 
  • #16
Now I need to implement bouncing off the walls...
 

Similar threads

  • · Replies 7 ·
Replies
7
Views
2K
  • · Replies 14 ·
Replies
14
Views
2K
  • · Replies 10 ·
Replies
10
Views
2K
  • · Replies 9 ·
Replies
9
Views
2K
  • · Replies 19 ·
Replies
19
Views
4K
  • · Replies 32 ·
2
Replies
32
Views
3K
  • · Replies 11 ·
Replies
11
Views
2K
  • · Replies 7 ·
Replies
7
Views
2K
  • · Replies 8 ·
Replies
8
Views
2K
  • · Replies 14 ·
Replies
14
Views
1K