Top Banner
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
16

A graphic library and an application for simple curve manipolation

May 11, 2015

Download

Education

The project consists in a software that uses a developed library in the Intermediate project to construct complex functionalities.
The functional asked requisites are:
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.
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: A graphic library and an application for simple curve manipolation

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

Page 2: A graphic library and an application for simple curve manipolation

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.

Page 3: A graphic library and an application for simple curve manipolation

Summary

o JOGLo Intermediate Project

o Painto Panzer

o Collision detection

o Inclined Planeo Demo

o Final Projecto GUIo Demo

Page 4: A graphic library and an application for simple curve manipolation

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 .

Page 5: A graphic library and an application for simple curve manipolation

Intermediate ProjectIntermediate project consists in

providing a set of functionalities (a

java library) used to generate

simple JOGL applications in

which we use them.

Page 6: A graphic library and an application for simple curve manipolation

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.

Page 7: A graphic library and an application for simple curve manipolation

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.

Page 8: A graphic library and an application for simple curve manipolation

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.

Page 9: A graphic library and an application for simple curve manipolation

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.

Page 10: A graphic library and an application for simple curve manipolation

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).

Page 11: A graphic library and an application for simple curve manipolation

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.

Page 12: A graphic library and an application for simple curve manipolation

Demo

Intermediate Project demo

Page 13: A graphic library and an application for simple curve manipolation

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.

Page 14: A graphic library and an application for simple curve manipolation

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

Page 15: A graphic library and an application for simple curve manipolation

Demo

Final Project demo

Page 16: A graphic library and an application for simple curve manipolation

Questions