I am going to try to make this a quick blog post since I just pulled an all-nighter to finish my 610 assignment. The major thing that I've implemented was an XML schema to let me create more complex folds. The XML schema is setup as follows ( removed the <> since blogger thinks I am trying to type HTML):
Lattice
Size width height /Size
RotSpring
AxisId1 x y /AxisId1
AxisId2 x y /AxisId2
MomentId1 x y /MomentId1
MomentId2 x y /MomentId2
RestAngle f /RestAngle
Direction 0 /Direction
/RotSpring
/Lattice
The size determines the size of the lattice you want to use in terms of point masses on the width and length. The RotSpring tag holds all the information a rotation spring in my simulation has. The AxisIds are the rotation axis and the moment arms are particles you are applying forces to. The rotation spring then has a rest angle and the direction (0 = Valley, 1 = Mountain). Then you can apply more and more rotation springs to make the folds as complex as you want. The nice thing is that I am assuming you are starting from a flat sheet. This means that I can easily detect when structure, bend or shear springs intersect with the rotation springs. So after all the rotation springs are added, I add the structure, bend and shear springs to the system using the standard grid. However before I add the spring I do a check to make sure the spring does not intersect with rotation spring. This allows for flat folding along the rotation springs and a full grid everywhere else.
I have already created several lattices using the XML schema, but that just revealed a lot of bugs. I was able to fix a few obvious ones that were causing problems. However I realized that using a dot product to find the angle along the rotation axis does not always work. The dot product returns an angle that is along a rotation axis that is cross product of the two vectors. This is not the rotation axis I necessarily want.
Therefore I developed a method to find the correct angle. I am given two vectors, a, b and a rotation axis between them, r. We can define a plane created by a and r. We can then project b into that plane and get proj_b. I think that the correct angle will be defined as dot(proj_b, a). I need to check the math, and there are a few corner cases, but I think this will fix a few problems.
There are other bugs, but I'll post again with those when I've gotten some sleep and I don't have up coming interviews tomorrow.
Do you have a movie of the multiple fold we talked about Wednesday? I was curious to check it out.
ReplyDelete