Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  Getting the force acting on a Rod
#1
Pregunta 
Hello, pretty simple question I was hoping for some help with.

I have a rod; I want to know how much force is acting on one of its elements/particles. That is, how much total force are the constraints exerting (how deformed the rod is).

I don't know how to approach this, outside of doing a clunky measurement of the particle's position vs its rest position. I imagine it involves something to do with reading the constraint batch data in the solver?
Reply
#2
(23-04-2024, 08:52 AM)astro.domine Wrote: Hello, pretty simple question I was hoping for some help with.

I have a rod; I want to know how much force is acting on one of its elements/particles. That is, how much total force are the constraints exerting (how deformed the rod is).

I don't know how to approach this, outside of doing a clunky measurement of the particle's position vs its rest position. I imagine it involves something to do with reading the constraint batch data in the solver?



Hi,

You'll need to read the "lambda" array from each constraint batch. The constraints you're interested in for a rod are StretchShear and BendTwist.

These "lambdas" are lagrange multipliers, you can convert them to forces (expressed in newtons) by dividing by the step time squared. There's an example of this in ObiRope.cs, ApplyTearing() method: it iterates over all distance constraints, calculating the force they're exerting and then selecting the ones with largest force to tear.

Each individual constraint calculates and applies its own lagrange multiplier, ao you'll have to sum these up.

Quote:how much total force are the constraints exerting (how deformed the rod is).

Note these are two completely different things. Stress is the force, strain is the deformation caused by it. The relationship between them is often non-linear.
Reply
#3
Beautiful, thank you very much for the explanation. Using the code from 'Rope.ApplyTearing()' I was able to sum up the strech/shear/bend on the rod and use that for haptic feedback (working on a VR fishing rod).

(23-04-2024, 09:52 AM)josemendez Wrote: Note these are two completely different things. Stress is the force, strain is the deformation caused by it. The relationship between them is often non-linear.

That totally makes sense (because the resultant deformation is dependent on all the different constraint parameters, element length, etc).
Reply
#4
(23-04-2024, 09:52 AM)josemendez Wrote: These "lambdas" are lagrange multipliers, you can convert them to forces (expressed in newtons) by dividing by the step time squared. There's an example of this in ObiRope.cs, ApplyTearing() method: it iterates over all distance constraints, calculating the force they're exerting and then selecting the ones with largest force to tear.


Actually, one more question; I don't quite understand the mathematics here well enough to know.

When reading the lambdas (Lagrange multipliers) of the StretchShear/BendTwist constraints, I see that the values flip between negatives & positives depending on the way the rod is bending. Does this mean I should be taking the absolute values when attempting to sum the total force, or should I let them counteract each other?
Reply
#5
(24-04-2024, 08:01 AM)astro.domine Wrote: Actually, one more question; I don't quite understand the mathematics here well enough to know.

When reading the lambdas (Lagrange multipliers) of the StretchShear/BendTwist constraints, I see that the values flip between negatives & positives depending on the way the rod is bending. Does this mean I should be taking the absolute values when attempting to sum the total force, or should I let them counteract each other?

Forces have a direction and a magnitude. In constraint jargon, the direction is called "gradient", and the magnitude (the Lagrange multiplier) may be along the positive or the negative part of the gradient.

For instance in a stretch constraint, stretching the rod would result in positive lambda, compressing it would result in a negative lambda (if memory serves well, might be the other way around!).

So if you just want to know how "large" the force is, take the absolute value of the force.
Reply