Sign in to follow this  

Constraints

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

In what context?

In general, a "constraint" is just an equation or inequality that "limits what you can do."

For instance, suppose you want to minimize the function

f(x, y) = x^2 + y^2

over all x,y. By this, I mean that you want to find the values for x and y that make f(x, y) smallest. Now, the minimum occurs when x=0 and y=0.

But consider another, related problem: Let's say you want to minimize this same function, but now subject to the constraint that x+y=1. Now you can't just choose x=y=0, since that doesn't satisfy the constraint. The answer actually turns out in this case to be x=y=1/2. There are a number of ways to solve this problem; here's a geometric interpretation:

The function f(x,y) returns the distance, squared, of any point (x,y) in the plane from the origin, (0,0). The constraint x+y=1 represents a line passing through the points (x,y)=(1,0) and (x,y)=(0,1). What is the point on this line closest to the origin? If you draw this on paper, it'll be pretty obvious that the answer is (1/2, 1/2).

So, that's one example of a constraint. This was a specific example of a constrained minimization problem.

Here's another example: Let's say that you have a bunch of balls, numbered 1 through 10, floating in outer space, with some initial velocities. You know the equations of motion for these things; it's pretty simple. But now let's say that you connect these balls in a line with a string. You can think of this as 9 constraints: The distance from ball 1 to ball 2 cannot exceed a certain value; the distance from ball 2 to ball 3 cannot exceed a certain value; etc. These are inequality constraints. In computer graphics, one way to deal with these kinds of constraints is to connect the balls with very stiff springs of this length; this will ensure that they never get much closer than some prescribed value. But you should understand that the springs are not constraints. They are just a specific way to approximately ensure that the constraints are satisfied, in this instance, for this particular problem.

I'm not sure that the explanation I just gave was all that great, but I hope it was helpful.

Share this post


Link to post
Share on other sites
Hello,

What i understand from your Constraint context:

The Constraint is minimum and maximum value for "something". Its like in IK System: minAngle, maxAngle.

Its Limit of some value.

Quote:

e.g if "rope" between 2 balls "exceeds the limits" then they are "colliding".


Are what i am thinking correct?

Thanks,
Kasya

Share this post


Link to post
Share on other sites
Quote:
Original post by KasyaThe Constraint is minimum and maximum value for "something". Its like in IK System: minAngle, maxAngle.


That's one kind of constraint. And from the sound of the things you're talking about, I'd guess these are the kinds of constraints you're most interested in. But from a math point of view, a constraint is most generally ANY rule that says that there are only certain things you're allowed to do. It could be something as exotic, I suppose, as "the sum of these numbers must be prime." ANY rule.

Quote:

e.g if "rope" between 2 balls "exceeds the limits" then they are "colliding".


"The balls cannot intersect one another" is certainly a constraint, but that wasn't what I was talking about when I brought up the rope. My particular example was more like this: If two balls of radius r, 'A' and 'B,' with positions (xa, ya) and (xb, yb), respectively, are connected by a rope of length L, then there is the constraint,

sqrt((xa-xb)^2 + (ya-yb)^2) - 2r <= L

i.e., the centers of the two balls cannot get farther apart than L+2r, because there's a rope connecting them. You can approximately satisfy this constraint by treating the rope as a very stiff spring, that can only pull (and not push); the purpose of this spring is to pull the balls closer to each other if they start to get too far apart.

But there is ALSO another constraint -- and I think this is more like what you're talking about -- that says,

sqrt((xa-xb)^2 + (ya-yb)^2) > 2r

i.e., the two balls cannot intersect (collide). You could satisfy this constraint with a very stiff spring that can only push (and not pull); the purpose of this spring is to pushe the balls apart if they begin to get too close.

But there are lots of ways to handle constraints. For instance, people don't normally use "springs" to handle collisions. Normally they detect the instant in time just before a collision and apply an impulse to the object to avoid the collision. You could do this for the ropes, too, actually, and it would probably be more robust, but for some reason people often simulate ropes as very stiff springs.

Anyway, in conclusion, a constraint is just a rule that says that there's something your system can't do. Then you need to come up with some way to keep your system from doing it, in a physically realistic way.

Share this post


Link to post
Share on other sites

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

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this