Report ... Index ... Program

Index:
  1. 1. Definition of assignment
  2. 2. Theory
  3. 3. Geometric transformations
  4. 4. Computer program
  5. 5. Conclusions
  6. 6. Sources

1. Definition of the assignment

You have to write a computer program in "JavaScript", which will be able to generate a crowd of 3D points, based on the mathematical expression and represent them as a surface in space. The surface has to be plotted with PHIGS graphic library.

In the program You must integrate a modul, which calculates maximum and minimum value of the function to determine the scale factor of the plotted surface. Mentioned scale factor is foundation for viewing the whole surface on the monitor.

Back to index


2. Theory

Analitical surfaces are special branch of the mathematics - analitical geometry, which deals with geometrical bodies with some analitical methods. The first man, who work on mentioned branch was Descartes. Cartezian coordinates on the surface are solutions of some equations or non - equations.

In mathematics we know some significant surfaces, defined by equations with exactly defined structure. In mathematics they're called surfaces of the second order, but they are just a store of values of functions with two variables, which are represented as surfaces.

The principal idea how to generate analitical surface is shown on the image 1.

Generiranje ploskve v prostoru

Image 1: Principal idea

The "string" f(x,y) is the surface equation. This is a regulation (a rule), which all points from X - Y plane "transforms" to the point in the space, which is for the distance Z from the X - Y plane. On mentioned way is defined every point on the surface.

The most common types of surfaces, centered in (0, 0, 0) along with their equations, are collected in table 1.


Table 1: Surfaces of the second order
Picture of the surface Name Equation
Slika troosnega elipsoida Elipsoid
Slika rotacijskega hiperboloida Rotational hyperboloid
Slika elipticnega paraboloida Eliptical paraboloid
Slika hiperbolicnega paraboloida Hyperbolical paraboloid
Slika stozca Cone
Back to index
3. Geometric transformations

Geometric transformations are mathematical operations, which transforms one point with coordinates (x, y, z) to another point with other coordinates. The connection between the new and the old point is executed by 4×4 matrix, which structure determines, where the new point is located. In geometry exists three main transformations: translation, rotation (revolution) and scalling. We use homogeneous coordinates to deal with them in the same way.

In cartesian coordinate system the point is presented with three coordinates - (x, y, z). To describe the point in homogeneous coordinate system we need four coordinates - (X, Y, Z, W). The connection between cartesian and homogeneous coordinate system is: x = X / W, y = Y / W in z = Z / W. In computer graphics W is always equal to 1.

If we write a point in homogeneous coordinates, the transformation matrixes are written at the same way as in table 2 below:


Table 2:Geometric transformations
Translation
Scaling
Rotaion about X axis
Rotation about Y axis
Rotation about Z axis

Otherwise, the geometric transformation is written with just one matrix equation: A2 = [M] × A1 , where is A1 the first (old) point and A2 the second (transformed, the new) point. [M] are the transformation matrixes, defined in table 2.

Back to index


4. Computer program

Computer program is written in JavaScript computer language. This is the language, used for Web presentations. It was developed by Netscape Communications company, which wanted to supply their Web browser Navigator with some programable objects. Netscape was the first software manufacturer, who integrated Java code support in the browser.

JavaScript is something entirely different then Java. JavaScript is programable extrusion of HTML language and It's not purposed for solving of very complex problems, but It's very convenient for controling the HTML code. A program code, written in JavaScript, has an outstanding property: it's very easy to use it, because You don't need special environments and translators. It can be used in completely the same way as the code, written in HTML so It can be tested in any Java/JavaScript supported Web browser.

PHIGS - Programmer's Hierarchical Interactive Graphics System - is a graphic library, which contains about 400 functions, allowed user to show and manipulate with 2D and 3D graphics objects. This library is an international standard, made by ISO - International Standard Organization. PHIGS contains a conscription of the familiar graphics objects, which are by specialists called graphic primitives. Every graphic object is presented with attributes, which defines It's color, size and location.

The structure of the program code is:

Back to index
5. Conclusion

For the end let's take a look at two similar computer programs for visualisation of functions with two variables from the Internet. They are both written in Java and they have integrated a modul for simple geometric transformations.

Back to index
6. Sources
© by 1021