Skip to content

Project done for the computer graphics course. The aim was to create a brush and a stretch tool. More details: http://iasonmanolas.wordpress.com/ .

Notifications You must be signed in to change notification settings

IasonManolas/StretchTool

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 

Repository files navigation

Uploading image.png…

StretchTool

I did this project for the lesson of computer graphics taught by Konstantinos Moustakas.

It had mainly to do with implementing a tool that stretches a model according to some weights given by the user. It was implemented using C++ and OpenGL. In the beginning I implemented ray cast picking. After that I used ray cast picking to create a brush drawing tool. The user can set the brushes colour (rgb),radius,hardness and permeability (draw both sides of the model). By clicking and draging the cursor above the models surface the user assigns colours to the models vertices. image

image

This brush was used afterwards so that the user can draw some weights ,with values from 0 to 1, on the models surface. The weights were visualized in red,meaning that the closer the color to black the closer to 0 the weight of the vertex is and similarly the more red the closer to 1 the weight is. At the areas where color is abscent the weights are equal to 0.

image

Subsequently the user gets to set a point on the model. This point is rendered as a blue polyhedron.

image

image

image

Finally the by use of the cursor the model is being stretched according to the weights. So the user moves the blue polyhedron and the model stretches accordingly. Note that the blue point is moved on the plane which normal points to the camera.

image

image

image

The above case , where the user places the blue point inside a red area is the easiest to implement. Things mess up when the user places the point elsewhere, because of the distribution of the weights (above the heighest weight is in the center of the red area which means that if the blue point was placed outside the red area the center of the area would stretch the most). To deal with that problem I dicided to redistribute the weights. The closer a vertex to the blue point the higher its weight. I implemented a breadth first search algorithm to find the distance of the vertices relative to the blue point. Below I breadth first search from the red polyhedron to the green one. Firstly I computed the segment from the red to the green. Then I found the two planes which are perpendicular to this segment and in addition the first plane contains the red point and the second the green point.As one can see the closer a vertex to the green plane is the higher its weight and vise versa for the red one.

image

Below are some pairs of blue point placement and red areas where I used the algorithm described above to stretch the model

image

image

image

image

About

Project done for the computer graphics course. The aim was to create a brush and a stretch tool. More details: http://iasonmanolas.wordpress.com/ .

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published