Public Group

# Deforming a mesh! Need a tip

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

## 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 i have to code this "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. With 1h 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! [Edited by - broady on December 5, 2008 2:24:08 AM]

##### Share on other sites
hello guys,

i khnow this is a long post so someone might result discouraged. It shouldnt be too hard to understand what i need but.

I have these 2 handles h1 and h2. Ineracting i just move these handles around on the plane. With a mouse i can just drag 1 handle but in a general sense i may move both the handles together(i.e. if i had 2 mouses).

So it's a problem of finding the proper transformation (it's an affine one: rotation + translation(+ scale for the length)) that takes h1 and h2 to the new positions (say h3 and h4). h3 and h4 change dinamically while interacting with the mouse or control system).

Now suppose i am good enough to find this transformation. This is the transformation that let the segment h1h2 to match exactly the segment h3h4. The main problem is that i have to move not just the handles, but i have to move accordling all the mesh's vertices.

I checked if there was something similar on the web, and i spotted this movie:

It's more than that i need: here he uses N handles, now i have just to code the 2-handled problem. It's at about 25 seconds and even later in the movie.

This is more a math problem? Is this the case to move this thread?

Thanks guys

1. 1
2. 2
Rutin
29
3. 3
4. 4
5. 5
khawk
14

• 11
• 11
• 23
• 10
• 9
• ### Forum Statistics

• Total Topics
633647
• Total Posts
3013109
×