Sign in to follow this  

Deforming a mesh! Need a tip

This topic is 3300 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

Hello guys, i will fastly explain what i did till now. I first import an image (say a targa image) wich containts a simple (in geometric sense)shape, i.e. a little dol with an head, hands, legs foots etc.... After a lot of coding i was able to build a triangular mesh approximating my shape (the doll). I used many classes: a Face pointing to 3 edges, every edge pointing to 2 vertices (without redundance of course). At the end of the process my mesh is just a colletion (i used STL vectors) of faces, edges and vertices properly related. Every vertex has its texture coordinates, so drawning the mesh with texturing enabled i just view the original shape (i.e. i can have te same result using gldrawpixles without textures). Now my code works in this way: dragging with the mouse i combine mouse coordinates with vertex coordinates. For every vertex (say v) i modify its v.x coord in a way proportional to the v.y coord and to mouse coords (v.y is always costant)(note that "higher" points have a major y so the deformation is greater). So at the end according to the mouse movement i have a bending now on the right now on the left shape. I hope this is clear, it's not so easy to axplain. The mesh deformation is not logically related with the dragging mouse but this was just to try if my mesh-texture system was working properly and it's simply perfect :D As i said this was a try, such that to deform the mesh i dont have to click in the shape, it works even if i click out of the shape, it doesnt matter. Now i have to code an other "usage": suppose i have 2 control points (say handles): h1 on the head and h2 on the stomach. h1 and h2 simply rapresent constrained vertices. Dragging the handles i want to deform the mesh in a reasonable way, for example: 1- if i pull down h2 the shape will be streched vertically but h1 will remain fixed 2- if i drag h2 over a circle the shape will just rotate on the center h1 3- the general case is a mix of 1 and 2. (The final case will be with N handles and this will be a pain -.-) I am thinking how to solve this: it should be a translation-rotation-scaling problem. Ah u can easly imagine that with just 1 handle the deformation is just a translation. I will just move the whole image on the plane without deforming it! Any tip on how to solve the 2 handles problem? If you solve the N-handles problem wont be bad :D Have a nice day! Bro!

Share this post


Link to post
Share on other sites

This topic is 3300 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