Opale
  presentation
  news
  faq
  docs
  team
  download
  Modules
  2d
 
  presentation
  examples
  doc
  links
 
3d
 
ode
  matrix
 
parser
Applications
Bugs
 

Examples

The topic of this page is to present the 2D module with simple and different examples : the first one about the use of the API in a java program; the second about data file and its interpretation; and the last, a good example to display differential equation solution solved by the module ODE.


1. Function display

Here is an example which displays functions in a window. These functions are defined in a direct rectangular coordinate system and are :

  • a conic
  • a sinus
  • the curve of equation y=x³ - x
  • a parametric curve

Look at the source ex1.java. After compiling, you will see :

exemple 1


2. Data file

This example presents the minimal java program to load and display the content of a data file. It describes 2D object like a conic, points, a vector .. all defined in a no-rectangular coordinate system in this example. In the other hand, the display is automaticaly done in a rectangular one.

Look at the data file and the code source ex2.java. Here is the display :

exemple2


3. Pendulum

At last, a concrete and interesting example : concrete because it talks about differential equation solving involved a deadened pendulum ; interesting because it uses both ODE module for the solving and 2D module for the display.

The program try to solve the no-linear system of deadened pendulum with 15 different initial conditions.
Look at the source Pendule.java. The first part define the problem and solve it, and the second opens a window and displays the solutions, using the 2D module :

pendule


Opale Team : January 31 2004 23:14:10.






valid xhtml image