# mass constrained to curve

This topic is 3326 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

i was reading this paper by andrew witkin. i had read this a year ago or so and never really carried through to understanding/implementing what i wanted to out of it. the first constraint example makes sense somewhat except that i don't see exactly how to derive the equations. i haven't had calculus since high school </disclaimer>, how is C' derived from C etc.? also, what's up with the 1/2 in the positional constraint? (the rest of the positional constraint makes sense to me) anyway, it does make sense after that and so i can implement a mass constrained to a unit circle easily. but i can't seem to think of how to apply this methodology to a parametrized curve. position in witkin's example has geometric significance for several reasons here that don't necessarily exist in a curve scenario; would i be able to substitute the gradient of the curve for the position vector maybe? any help is appreciated. [Edited by - newtomaths on October 29, 2009 7:27:18 AM]

##### Share on other sites
The 1/2 is arbitrary. He probably put it there so the derivatives (velocity and acceleration) don't have a 2 in front. You get C' from C (I guess that's what you meant) by differentiating. You need to learn some calculus to know how to do that.

You typically don't see a parametrized curve as a constraint. Do you have a specific example in mind?

##### Share on other sites
Quote:
 Original post by newtomathsi was reading this paper by andrew witkin.

Imho, this is one of the most obfuscated papers I've read on physics simulation. The notation takes some getting used to. I haven't implemented all of this into code yet, but I won't mind posting a few examples for comparison if you get stuck on this one. :-)

Cheers,
Mike

##### Share on other sites
Quote:
 Original post by alvaroThe 1/2 is arbitrary. He probably put it there so the derivatives (velocity and acceleration) don't have a 2 in front. You get C' from C (I guess that's what you meant) by differentiating. You need to learn some calculus to know how to do that.

ok, yes i definitely need work on calculus... i was asking whether C' comes from differentiating C as opposed to just writing a velocity constraint that maintains the positional constraint, C. are you able to point me to a resource that explains how to differentiate from C to C'? a rule or something? the bit that i know/remember doesn't really help me grasp what i'm seeing in the paper there...

Quote:
 You typically don't see a parametrized curve as a constraint. Do you have a specific example in mind?
no, nothing specific, just curious. i couldn't resolve in my head how to handle a spline. it just seems like witkin's example is really convenient on several levels.

@h4tt3n i'll see if i can dig up what i had done!

thanks!

##### Share on other sites
Yeah, the notation is needlessly confusing. What it's really trying to do is look a parametric curves that would describe motion and see what conditions the restriction imposes on the curve. In particular, C means that x^2+y^2 has to be 1, and C' means that the velocity has to be perpendicular to the vector (x,y). The condition C'' means that the radius of curvature has to be 1.

But it's all written by differentiating directly on vectors, which is convenient for him to make operations, but will confuse a lot of the possible readership for this article.

You have to think of x' in his formulas as a curve parametrized by time, which describes how a particle moves. Then he uses the formula for the derivative of a product and the chain rule to do his operations.

I have to do work now, but if you are interested, I can try to rewrite all his formulas using a more understandable notation at some other time.

##### Share on other sites
that would be amazing! and yeah, i understand each of the constraints individually... i have an intuitive understanding of calculus but no real experience solving calculus problems other than with numerical integrators computationally so it's easy to get stuck with stuff like this! i thought maybe it was formulated to the chain rule but wasn't able to piece it together. thanks again if you get the chance to rewrite his formulas or not!

[Edited by - newtomaths on October 29, 2009 9:03:14 AM]

##### Share on other sites
OK. Here we go, using (x(t), y(t))' instead of x'. The position of the particle is a function of time, and that's the variable with respect to which we'll differentiate.

(1) C(t) = 1/2 (x(t)^2 + y(t)^2 - 1)
The 1/2' is here only so we don't have a coefficient in front of everything in the other formulas.

(2) C'(t) = 1/2 (2*x(t)*x'(t) + 2*y(t)*y'(t)) = x(t)*x'(t) + y(t)*y'(t) = 0

(3) C"(t) = x(t)*x"(t) + y(t)*y"(t) + x'(t)^2 + y'(t)^2 = 0

(4)
x"(t) = (fx(t)+Fx(t))/m
y"(t) = (fy(t)+Fy(t))/m

(I used F instead of f with a hat because I don't know how to get a hat)

Now you can substitute x"(t) and y"(t) in (3) to get
(5) C"(t) = x(t)*(fx(t)+Fx(t))/m + y(t)*(fy(t)+Fy(t))/m + x'(t)^2 + y'(t)^2 = 0

or

(6) Fx(t)*x(t) + Fy*y(t) = -(fx(t)*x(t)+fy(t)*y(t)) - m*(x'(t)^2+y'(t)^2)

The kinetic energy is
T(t) = m/2 * (x'(t)^2 + y'(t)^2)

and its time derivative is
T'(t) = m * (x'(t)*x''(t) + y'(t)*y''(2)) = x'(t) * (m*x"(t) + y'(t) * (m*y"(t))

We again use (4) to get
T'(t) = x'(t) * m*(fx(t)+Fx(t))/m + y'(t) * m*(fy(t)+Fy(t))/m

Rearranging that, we get
T'(t) = x'(t) * fx(t) + y'(t) * fy(t) + x'(t) * Fx(t) + y'(t) * Fy(t)

Notice that the article incorrectly has `m' multiplying in the last part of the equation. Since we are going to just set that to 0 as a constraint, it doesn't really mess anything up, but it's a mistake.

So now we want to set the work done by F to 0, so
x'(t) * Fx(t) + y'(t) * Fy(t) = 0

This means that (Fx(t),Fy) is a vector in the direction of (x(t),y(t)) . In 2D I can follow the argument. In 3D, I would need to understand his "subtle point", which I don't fully get...

Let me know if you need me to keep going, or if this is enough to help you understand the paper.

I can see now why the author used vector notation, seeing how verbose formulas get when trying to avoid it.

By the way, it's really annoying that he doesn't know how to spell "principle". :)

##### Share on other sites
Quote:
 Original post by alvaroIn 2D I can follow the argument. In 3D, I would need to understand his "subtle point", which I don't fully get...

I do not see any "subtle point" that you have to worry about in 3D. The requirement is that the constaint force cannot do any work. The constraint force cannot have a component tangential to the curve/surface (manifold) on which the "particles" are required to live. In the PDF, the dot product of constraint force with tangent vector is zero, which says the constraint force does not have a tangential component. Imagine a particle constrained to a curve and a constraint force with a nonzero tangential component. That force would move the particle along the curve (that is, the force does work). In the absence of externally applied forces, this should not happen. So the requirement of no tangential component is reasonable.

Quote:
 I can see now why the author used vector notation, seeing how verbose formulas get when trying to avoid it.

Coordinate-free arguments are clean and concise. Derivations involving the separate components makes it difficult to wrap your head around the concepts. There is nothing obfuscating at all about the notation of the PDF. A lot of folks use coordinate-free arguments when writing about physics (I am one of them).

Quote:
 By the way, it's really annoying that he doesn't know how to spell "principle". :)

Well, he did correctly spell the word on the very first line of the PDF :) Witkin is well known for his work in computer vision and was a Professor at Carnegie Mellon. Then Pixar attracted him and Baraff away from the university. If you like the physics in Pixar's animations (for example, wind blowing through fur in Monsters Inc), then these guys most likely made it work.

##### Share on other sites
Oh, I get the "subtle point" now (his name, not mine).

I am all for not using coordinates. The part that I found confusing is that x is not just a position, but it's actually a time-parametrized curve, x(t), which wasn't at all obvious when x was introduced. Then the rest makes sense. I guess I am not used to reading Physics.

##### Share on other sites
thank you so much, it was actually enough to see what you did with the first differentiation, everything makes sense after that. but seeing the whole process worked out really is invaluable, thank you.

1. 1
2. 2
3. 3
Rutin
15
4. 4
khawk
14
5. 5
frob
12

• 9
• 11
• 11
• 23
• 12
• ### Forum Statistics

• Total Topics
633661
• Total Posts
3013220
×