Thursday, February 17, 2011

Torsion Springs

Heyho,
So I did not get to implicit or imex this week, but I did get to work on the rotational springs and got stuff folding.

I will first go over the implementation of the rotational springs.
Variables:
-axisPoint1
-axisPoint2
-momentArmPoint1
-momentArmPoint2
-springConst
-dampingConst
-restAngle
The first two points form the axis of rotation. The other two points define two moment arms from the midpoint of the axis. The spring and damping consts are used for force calculation. The rest angle is the desired angle between the moment arms.
In order to calculate the forces on the points on the moment arms I need to first calculate the torque generated by the spring on each moment arm. I am currently missing the damping part of the function, which causes explosions (see later in the post). Once I calculate the torque I can figure out the forces from that value. But since these are scalar values, I still need to find the force vector. I determined that if I take the cross product between the axis and the moment arm I get the force vector I want. So this lets me update the forces on the moment arm points and integrate the springs into the rest of the system.

So what does this all mean? Folding! I was truly amazed how well the rotational springs worked with the rest of the cloth sim. I setup relatively stiff values for all the linear springs and added the springs. I seem to get a surprising result that looks pretty close to paper. I have two videos showing the rotational springs interacting with the system. Note the videos are at x2 speed, because they are amazing slow otherwise.



In this first video I do a few things. The lattice is setup like a normal cloth sim grid. The red line through the center of the paper is the rotational spring. At the beginning I start the simulation with structure, shear, bend and rotational springs. One thing to note is that there is no spring between the center of the rotational axis that goes along the moment arm. Because of this the paper curls inward, responding to gravity and the bend springs keeping it from being completely stiff. I am pretty happy with this because it looks like if you were to roll up the paper. When the rotational spring is removed, the system unrolls back to normal. I then remove the bend springs and add the rotation spring back to show how it looks without the bend springs. You can really see where they got their name ;) The cool thing is that I have folded and unfolded in this manner several times and it seems like it goes pretty stable.



In the second video I made some changes to the lattice. There are two structural springs that run from the center to the ends of the paper where the moment arms are. They provide a good way to judge the angle you are seeing the paper folding. Another thing to not is that the shear springs that run across the bend spring are removed. I found that this is necessary or they will prevent a total fold.
The simulator goes pretty smooth until it gets to a point where gravity starts to out do the springs and the thing starts to collapse. At least I hope it is gravity. It is sort of hard to tell, but it is cool to see the lattice turn inside out... and then explode.
For next week I will play with constants, look at the explosion a little more closely and prepare for alpha reviews on Friday (Fear!). In front of Pixar (FEAR!).

2 comments:

  1. Its very informative and interesting article. Simple but very effective writing. Thanks for sharing such a nice post.
    Torsion springs

    ReplyDelete
  2. This is what i am looking for ........really you made my day.keep it up..........thanks.
    Torsion Spring

    ReplyDelete