Flattening a 3D structure
I am trying to flatten a 3D object made up of many triangles. The forces I am considering now is gravity and spring force in a mass spring system. However I am unable to do it naturally. As the object is being flatten to the planar base, I am expecting it to spread out as well but it is not. I think this is due to gravity only acting downward and not laterally. What other forces should I include in order to model this phenomenon?
My 3D object is something like a piece of crumpled or rollup paper that is placed on a flat plane like on a table. I am suppose to flatten this piece of paper so that I can restore its original flattened form.
I am now trying to do it this way. Upon plane collision, the particles will experience forces in the x/y direction so to simulate a "spreading out" effect. However, the improvement is still not that significant.
Hope you guys can offer me some advice.
You seem like you know how to implement the theory so here goes. Treat the "object" as a set of masses connected by springs. Actually, forget the springs idea and make each "spring" like string that can be stretched forever. Then, attribute a value to each "string" that is indicative of how much it has stretched. The key point here, though is to start at the top of "object" and work downward on vertex at a time. Flatten the highest vertex to the height of the next highest vertex, then flatten the 1st and 2nd vertex to the height of the 3rd highest vertex. This only works if the object is made like a stack of polygons connected at the vertices.
I know that sucks, but it's all I can come up with without adding substantially to the model format.
I know that sucks, but it's all I can come up with without adding substantially to the model format.
"Donkey, if it were me, you'd be dead."I cna ytpe 300 wrods pre mniute.
[OT] This thread would be best placed in the Physics forum. I think you'd get more replies.
Quote: Original post by DuncanBojangles
You seem like you know how to implement the theory so here goes. Treat the "object" as a set of masses connected by springs. Actually, forget the springs idea and make each "spring" like string that can be stretched forever. Then, attribute a value to each "string" that is indicative of how much it has stretched. The key point here, though is to start at the top of "object" and work downward on vertex at a time. Flatten the highest vertex to the height of the next highest vertex, then flatten the 1st and 2nd vertex to the height of the 3rd highest vertex. This only works if the object is made like a stack of polygons connected at the vertices.
I know that sucks, but it's all I can come up with without adding substantially to the model format.
Thanks for the suggestion, Duncan.
Well definitely check out other methods first. What I posted was just what I could come up wit hat that moment, so it's probably not the best. Or even okay. It does require that you squish the model kinda like it is a cross section. Your model can be in any format as you could just find what points on the model a horizontal plane intersects. If you use a set amount of points, say 1 vertex for every 5 degrees from the center of the object, then the object will squish with each "layer" being a connected triangle strip, which OpenGL renders nicely :)
Note that this method only works well for round objects whose dimentions in width and length aren't too far from each other. This would be good for human heads, weapons, fruit, many organic shapes, etc.
This would also be really cool because with a little work, you could embed the model within a texture! The model would just be a grayscale image whose hue defines the amount of stretch a triangle leg has. In the image header you'd need to know the values that the grayscale stretchiness stand for, e.g. white = no stretch, 50% grey = 3.0x stretch. This can easily be put into the alpha section of an image, and ignore the alpha layer in your drawing code. I'll try to get some drawings done to show you what I mean.
Here are some pictures showing how the layers are composed ( note that they are wrong! I wanted to get a uniform layer height, but messed up.):
And here is my horrible drawing depicting what happens. Squish-wise.
The layers should all be of the same height so that the triangles always have the correct "height" but their base length changes.
[Edited by - DuncanBojangles on July 14, 2004 1:15:06 AM]
Note that this method only works well for round objects whose dimentions in width and length aren't too far from each other. This would be good for human heads, weapons, fruit, many organic shapes, etc.
This would also be really cool because with a little work, you could embed the model within a texture! The model would just be a grayscale image whose hue defines the amount of stretch a triangle leg has. In the image header you'd need to know the values that the grayscale stretchiness stand for, e.g. white = no stretch, 50% grey = 3.0x stretch. This can easily be put into the alpha section of an image, and ignore the alpha layer in your drawing code. I'll try to get some drawings done to show you what I mean.
Here are some pictures showing how the layers are composed ( note that they are wrong! I wanted to get a uniform layer height, but messed up.):
And here is my horrible drawing depicting what happens. Squish-wise.
The layers should all be of the same height so that the triangles always have the correct "height" but their base length changes.
[Edited by - DuncanBojangles on July 14, 2004 1:15:06 AM]
"Donkey, if it were me, you'd be dead."I cna ytpe 300 wrods pre mniute.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement