Facoltà di Scienze Matematiche, Fisiche e Natural Corso di Laurea Magistrale in Informatica Principles of Computer Graphics - Projects slides - Student: Umberto Di Staso 142685 Professor: Raffaele de Amicis 2009/2010
May 11, 2015
Facoltà di Scienze Matematiche, Fisiche e NaturaliCorso di Laurea Magistrale in Informatica
Principles of Computer Graphics
- Projects slides -
Student: Umberto Di Staso 142685
Professor: Raffaele de Amicis
2009/2010
ContextStudy of the principles of Computer Graphics: basic knowledge,
basic tools to develop computer graphics applications,
mathematics in Computer Graphics
Context and Objectives
ObjectivesCreate a set of softwares that includes the concepts that we havelearned during the lessons.
Summary
o JOGLo Intermediate Project
o Painto Panzer
o Collision detection
o Inclined Planeo Demo
o Final Projecto GUIo Demo
JOGLJava OpenGL (JOGL) is a wrapper library that
allows Java programmers to use OpenGL
features.
JOGL makes possible the access to almost all
the available features,
to C programming language programmers.
JOGL has achieved notable successes in the
applications of Geo - Viewers .
In fact, NASA World Wind project has been
released with JOGL .
Intermediate ProjectIntermediate project consists in
providing a set of functionalities (a
java library) used to generate
simple JOGL applications in
which we use them.
Intermediate ProjectFunctionalities are divided in six categories:1. Vectors: this category contains all the operations about vectors, like the sum
between two of them, normalization, dot product, cross product and distance. 2. 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.
3. 2D Geometry: this category contains all the operations about simple 2D geometry, like lines, squares, rectangles, triangles, polygons and circles.
4. 3D Polygon Generation: it is the same as the category before, but in three dimensional space.
5. Curves: this category contains all the curves we have seen during the course, like Bezier, Hermite, Hermite splines and B-Splines.
6. Physics: this category contains some operations about physics.
Intermediate Project
I have created three different applications (based on a single java library) in which I have used all the functionalities that I have implemented.1. 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.
2. Panzer: the second application contains some functionalities about physics.3. Inclined plane: the last application contains the physics functionalities that I
have never used in the previous applications.
PaintAs we can see, users can draw figures
belonging to three macro categories:• 2D figures:
– Draw a simple line given 2 points.– Draw a square given center and edge length.– Draw an equilateral triangle given center and edge length.– Draw a circle given 3 non-aligned points.– Draw a polygon given center and number of edges, center
and radius.– Ability to center the figures.
• 3D polygon:– Draw a cube given center and edge length.– Draw regular pyramid given edge length.– Draw cone given radius and height.– Draw sphere given radius and center.
• Curves:– Draw Hermite given p0, p1 and the 2 vectors.– Draw Bezier given 4 control points.– Draw Hermite spline given a set of points and 2 vectors.– Draw BSpline given a set of points and the degree.
PanzerKey points:• 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.• Bullet: little polygon with 8-16 edges.• Trajectory: trajectory of the bullet. This particular kind of parabola is calculated using the formula of parabolic motion
of projectiles.• World: set of segments that composes the impact surface.• 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.
Collision Detection The core of this application is, obviously, the
algorithm that tells us when a bullet impacts on a
surface. To understand properly how this
algorithm works, is surely useful to look at the
image on the right.
As we can see, the bullet is basically a little
polygon with 8-16 edges. The number of edges
influences the precision of our collision detection.
The algorithm works in this way:
For each radius (in red) of the bullet it checks if one of these intersects a component of the impact surface (in green).
Inclined PlaneThe application consists in a simple inclined
surface with a corpus on it. Using the “Spacebar”
we release the object and we can see how the
physics phenomenon called “uniform
acceleration” (it depends on the gravitational
acceleration and the angle of the inclined plane)
brings changes on the motion of the corpus.
Demo
Intermediate Project demo
Final ProjectThe project consists in a software that uses the library developed in the
Intermediate project to construct complex functionalities.
The asked functionality requisites are:• Load a picture in background.• Generate different curves using points setted by the mouse.
– Hermite Spline,– Bezier Spline,– BSpline,– Lagrange.
• In this way we can isolate the perimeter of the previous loaded picture.• Move single points using the mouse drag property.• Select multi points and move them together.• Curves must be connected to each other.• Save the composition of curves in a file.• Load the composition of curves saved before.• 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• Change in real time the kind of curve that interpolates a set of points.
Final Project - GUIAs we can see in the image on the right,
the software gives us a large set of choices
used for different kinds of operations:• Picture canvas• Clear button• Delete last point• Move points• Change curve• Curve select• Load image• Load a blank image• Restore default image:• Load point file• Load a curve• Save curve• Hide points over the screen
Demo
Final Project demo
Questions