Successfully reported this slideshow.
Upcoming SlideShare
×

# A graphic library and an application for simple curve manipolation

1,040 views

Published on

The project consists in a software that uses a developed library in the Intermediate project to construct complex functionalities.
1. Load a picture in background.
2. Generate different kinds of curves using points generated by mouse:

a. Hermite Spline,
b. Bezier Spline,
c. BSpline,
d. Lagrange.
In this way we can isolate the perimeter of the previous loaded picture.

3. Move single points using the mouse drag property.
4. Select multi points and move them together.
5. Curves must be connected to each other.
6. Save the composition of curves in a file.
7. Load the composition of curves saved before.
8. Load a point file ad interpolate the points using the available curves. In this way we can observe the differences generated when same points are interpolated by different kind curves.
9. Change in real time the kind of curve that interpolates a set of points.

Published in: Education
• Full Name
Comment goes here.

Are you sure you want to Yes No
• Be the first to comment

• Be the first to like this

### A graphic library and an application for simple curve manipolation

1. 1. Facoltà di Scienze Matematiche, Fisiche e Naturali<br />Corso di Laurea Magistrale in Informatica<br />Principles of Computer Graphics- Projects slides -<br />Student: Umberto Di Staso 142685<br />Professor: Raffaele de Amicis<br />2009/2010<br />
2. 2. Context<br />Study of the principles of Computer Graphics: basic knowledge,<br />basic tools to develop computer graphics applications,<br />mathematics in Computer Graphics<br />Context and Objectives<br />Objectives<br />Create a set of softwares that includes the concepts that we have<br />learned during the lessons. <br />
3. 3. Summary<br /><ul><li> JOGL
4. 4. Intermediate Project
5. 5. Paint
6. 6. Panzer
7. 7. Collision detection
8. 8. Inclined Plane
9. 9. Demo
10. 10. Final Project
11. 11. GUI
12. 12. Demo</li></li></ul><li>JOGL<br />Java OpenGL (JOGL) is a wrapper library that<br />allows Java programmers to use OpenGL<br />features.<br />JOGL makes possible the access to almost all<br />the available features, <br />to C programming language programmers.<br />JOGL has achieved notable successes in the<br />applications of Geo - Viewers .<br />In fact, NASA World Wind project has been<br />released with JOGL .<br />
13. 13. Intermediate Project<br />Intermediate project consists in<br />providing a set of functionalities (a<br />java library) used to generate<br />simple JOGL applications in<br />which we use them.<br />
14. 14. Intermediate Project<br />Functionalities are divided in six categories:<br />Vectors: this category contains all the operations about vectors, like the sum between two of them, normalization, dot product, cross product and distance. <br />Matrices: this category contains all the operations about matrices, like product between two matrices, determinant up 4x4 matrix, check and calculation of the inverse given a matrix.<br />2D Geometry: this category contains all the operations about simple 2D geometry, like lines, squares, rectangles, triangles, polygons and circles.<br />3D Polygon Generation: it is the same as the category before, but in three dimensional space.<br />Curves: this category contains all the curves we have seen during the course, like Bezier, Hermite, Hermitesplines and B-Splines.<br />Physics: this category contains some operations about physics.<br />
15. 15. Intermediate Project<br />I have created three different applications (based on a single java library) in which I have used all the functionalities that I have implemented.<br />Paint: the first application contains all about 2D geometry, 3D polygon generation and curves. Obviously to do this, I have used also vectors and matrices.<br />Panzer: the second application contains some functionalities about physics.<br />Inclined plane: the last application contains the physics functionalities that I have never used in the previous applications.<br />
16. 16. Paint<br />As we can see, users can draw figures<br />belonging to three macro categories:<br />2D figures:<br />Draw a simple line given 2 points.<br />Draw a square given center and edge length.<br />Draw an equilateral triangle given center and edge length.<br />Draw a circle given 3 non-aligned points.<br />Draw a polygon given center and number of edges, center and radius.<br />Ability to center the figures.<br />3D polygon:<br />Draw a cube given center and edge length.<br />Draw regular pyramid given edge length.<br />Draw cone given radius and height.<br />Draw sphere given radius and center.<br />Curves:<br />Draw Hermite given p0, p1 and the 2 vectors.<br />Draw Bezier given 4 control points.<br />Draw Hermitespline given a set of points and 2 vectors.<br />Draw BSpline given a set of points and the degree.<br />
17. 17. Panzer<br />Key points:<br />Panzer: little tank designed using a tree structure: each element that composes the panzer is drawn around the root point. In this way, I can move the tank simply by using a translation of the root point.<br />Bullet: little polygon with 8-16 edges.<br />Trajectory: trajectory of the bullet. This particular kind of parabola is calculated using the formula of parabolic motion of projectiles.<br />World: set of segments that composes the impact surface.<br />Informations: words that explain the angle of the gun, initial speed of the bullet, range of the shoot and finally, the max height of the bullet.<br />
18. 18. Collision Detection <br />The core of this application is, obviously, the<br />algorithm that tells us when a bullet impacts on a<br />surface. To understand properly how this<br />algorithm works, is surely useful to look at the<br />image on the right.<br />As we can see, the bullet is basically a little<br />polygon with 8-16 edges. The number of edges<br />influences the precision of our collision detection.<br />The algorithm works in this way:<br /> For each radius (in red) of the bullet it checks if one of these intersects a component of the impact surface (in green).<br />
19. 19. Inclined Plane<br />The application consists in a simple inclined<br />surface with a corpus on it. Using the “Spacebar”<br />we release the object and we can see how the<br />physics phenomenon called “uniform<br />acceleration” (it depends on the gravitational<br />acceleration and the angle of the inclined plane)<br />brings changes on the motion of the corpus.<br />
20. 20. Demo<br />Intermediate Project demo<br />
21. 21. Final Project<br />The project consists in a software that uses the library developed in the<br />Intermediate project to construct complex functionalities.<br />The asked functionality requisites are:<br />Load a picture in background.<br />Generate different curves using points setted by the mouse. <br />HermiteSpline,<br />Bezier Spline,<br />BSpline,<br />Lagrange.<br />In this way we can isolate the perimeter of the previous loaded picture.<br />Move single points using the mouse drag property.<br />Select multi points and move them together.<br />Curves must be connected to each other.<br />Save the composition of curves in a file.<br />Load the composition of curves saved before.<br />Load a point file ad interpolate the points using the available curves. In this way we can observe the differences generated when the same points are interpolated by different kind of curves<br />Change in real time the kind of curve that interpolates a set of points.<br />
22. 22. Final Project - GUI<br />As we can see in the image on the right,<br />the software gives us a large set of choices<br />used for different kinds of operations:<br />Picture canvas<br />Clear button<br />Delete last point<br />Move points<br />Change curve<br />Curve select<br />Load image<br />Load a blank image<br />Restore default image:<br />Load point file<br />Load a curve<br />Save curve<br />Hide points over the screen<br />
23. 23. Demo<br />Final Project demo<br />
24. 24. Questions<br />