Giter Site home page Giter Site logo

aaplot's Introduction

-----------------------------------------------------
aaplot 0.7
24. October 2008
by: Aapo Rantalainen
GNU GPL 3.0 (or later)
------------------------------------------------------

INFO
====
aaplot is function plotting library/toolkit.

PREREQUIRE
==========
Yuo need libgl. (In Ubuntu: libglu1-mesa-dev)
If you want take screenshots, you need libpng (In Ubuntu: libpng3-dev)
If you want window-icons, you need linXpm (In Ubuntu: libxpm-dev)


USAGE
=====
Make c-file, include aaplot.h, compile, run.

1)
c-file like this:
#include "aaplot.h"

double f(double x) {
return 3*x*x + 4*x -5;
}

int main(){
 addRFunction(0,&f,0.01,"My Function");
  /* 0   = window number
    &f   = pointer to your function
    0.01 = stepping of x 
   "My Function" = just some title
  */
 drawAll();
 return 0;
}

2)
compile like this:
gcc -lXpm -lpng -lGL my_file.c aaplot.a

3)
run like this:
./a.out

EXAMPLES
========
Take a look at example-files.
    * example1: R->R functions
    * example2: R2->R functions
    * example3: R->R3 curves
    * example4: R2->R3 curves
    * example5: file+arrays (2d and 3d)
    * example5B: file of 3d-data (saucepan.dat)
    * example6: about user clicked (selected) points
    * example7: three windows
    * example8: changing attributes of functions/tables 

    * example1P: R->R, with parameters
    * example2P: R2->R, with parameters
    * example3P: R->R3, with parameters
    * example4P: R2->R3, with parameters 

    * example_butterflies: four parameterized curves
    * example_many_curves: just many (>20) curves,
    * example_rings: three rings
    * example_gsl: aaplot with gsl_matrix 

You can compile them all:
make all

GUI
===
With mouse

Right mouse button

    Opens the Menu. Menu entries can be clicked with left or right button. 

Menu

    * Toggle Move/Rotate -mode
    * Change cursor to crosshair
    * Prints manual (to console at this moment)
    * Reset view back to normal
    * Hiding/Unhiding coordinateplanes (XY,YZ,XZ)
    * Close all gl-windows.
    * With every function/table
          o Change title
          o Change point size
          o Change stepping (both if have two steppings)
          o direction (e.g. f(z)=x)
          o New color (pick next random color)
          o Hide/Unhide 

Left mouse button + moving mouse

    * If you are movingmode it will pan (eg. move) the whole view.
    * If you are rotatingmode it rotates the view.

          moving left <-> right

              Y-axis stay in place and zx-plane rotates 

          moving up <-> down

              X-axis stay in place and zy-plane rotates 

Middle mouse button

    Marks one point to coordinate. (This works correct only if view is not rotated) 

Mouse wheel

    Zooming in and out.

With Keyboard

1 and 2	       X-axis stay in place and zy-plane rotates
3 and 4         Y-axis stay in place and zx-plane rotates
5 and 6         Z-axis stay in place and xy-plane rotates
z               Take screenshot
UP/DOWN 	Scales y-axis
LEFT/RIGHT 	Scales x-axis
Shift + UP/DOWN 	Scales z-axis
a/d : increase x-boundaries
w/s : increase y-boundaries
q/e : increase z-boundaries
A/D : decrease x-boundaries
W/S : decrease y-boundaries
Q/E : decrease z-boundaries
ESC 	Close all windows

+/- : zooms in and out\n\
m   : toggles rotate/moving -mode\n\
n   : resets view\n\




HACKING
=======
Filenames beginning with aaplot* are one layer, wroted just for this project.
Filanames beginning with aaglut* are adopted from openglut-project. (with some modifications)

So I suggest you start with aaplot-files. It is like gl with glut programming. If something 
do not work, it might be because of my aaglut-modifications.

aaplot's People

Contributors

aapo avatar

Watchers

 avatar

aaplot's Issues

Test issue - don't understand

What steps will reproduce the problem?
1. Download program

What is the expected output? What do you see instead?
Black screen

What version of the product are you using? On what operating system?
I don't know

Please provide any additional information below.
This is just a test issue to test the 'issue tool', not a real issue

Original issue reported on code.google.com by [email protected] on 13 Jun 2008 at 7:59

discuss: generating (randomly) RGB-colors

This is discussion about generating (randomly) RGB-colors, so they are not
all approx [0.5 , 0.5 , 0.5]?

First version:
{{{
void getColors(float *red, float *green, float *blue){
int r=rand ();
int g=rand ();
int b=rand ();

*red=(r+0.0)/RAND_MAX;
*green=(g+0.0)/RAND_MAX;
*blue=(b+0.0)/RAND_MAX;
}
}}}


Second version: (little test-tweaking)
{{{
void getColors(float *red, float *green, float *blue){
int r=rand ();
int g=rand ();
int b=rand ();

*red=(r+0.0)/RAND_MAX;
*green=(g+0.0)/RAND_MAX;
*blue = *red+*green;
if (*blue >1.0)
   *blue=*blue-1.0;
}
}}}


Third version: (this is almost good)
{{{
/*
Because random number generator is NOT initialized, this gives same numbers
each time when program runs.
I try generate three numbers [0,1], that all is not approx 0,5.
First I randomize red and green, and if they are 'too middle' I fix blues
value.

The point is:
 red   = random value [0,1]
 green = random value [0,1]

There are 4 'slots' which red and green might be.
  0    low     mid=0.5     hig    1
R |     |         |         |     |
G |     |         |         |     |


case 1:
  0    low     mid=0.5     hig    1
R |     |    X    |         |     |
G |     |    X    |         |     |
B |     |         |         |  X  |

case 2:
  0    low     mid=0.5     hig    1
R |     |         |    X    |     |
G |     |         |    X    |     |
B |  X  |         |         |     |

case 3:
  0    low     mid=0.5     hig    1
R |     |         |    X    |     |
G |     |    X    |         |     |
B |  X  |         |         |  X  |

case 4:
  0    low     mid=0.5     hig    1
R |     |    X    |         |     |
G |     |         |    X    |     |
B |  X  |         |         |  X  |

*/
void getColors(float *red, float *green, float *blue){
int r=rand ();
*red=(r+0.0)/RAND_MAX;
int g=rand ();
*green=(g+0.0)/RAND_MAX;

float low = 0.2;
float mid = 0.5;
float hig = 1-low;
if (*red>low && *red<mid && *green>low && *green<mid)
   {
   *blue=(rand()+0.0)/RAND_MAX / (1/low) + hig;
   }
else if (*red>mid && *red<hig && *green>mid && *green<hig)
   {
   *blue=(rand()+0.0)/RAND_MAX / (1/low);
   }
else if (*red>low && *red<hig && *green>low && *green<hig)
   {
   *blue=(rand()+0.0)/RAND_MAX / 2.0;
   int b=rand (); /*toss a coin */
   if (b<RAND_MAX/2)
      *blue=*blue*2 / (1/low);
   else 
      *blue=*blue*2 / (1/low) + hig;
   }
else
   {
   int b=rand ();
   *blue=(b+0.0)/RAND_MAX;
   }

//printf("%lf,%lf,%lf\n",*red,*green,*blue);
}
}}}

Original issue reported on code.google.com by aapo.rantalainen on 28 Jun 2008 at 11:47

Crash when opening the plot window

What steps will reproduce the problem?
1. download the bzr branch: bzr branch http://lauta.dyndns.org/aaplot
2. make all
3. run an example: ./example2

What is the expected output? What do you see instead?
I thought I would see the graph but as soon as the window opens, it also
closes and I get error messages in the terminal.

What version of the product are you using? On what operating system?
bzr, revision 22 on Kubuntu Hardy.

Please provide any additional information below.
see http://pastebin.com/m4d0b123b for full details.

Display adaptor: 01:00.0 VGA compatible controller: ATI Technologies Inc
RV280 [Radeon 9200 SE] (rev 01)

3D acceleration not active, using vesa drivers.

Original issue reported on code.google.com by [email protected] on 17 Jun 2008 at 10:13

discuss: setting lights with GL

Discussing about:
How to set Lights, so surfaces looks clear?

Code looks like this, but I'm not pleased with it. Do I need more lightsources?

GLfloat pos[4] = {0., -5., 0., 1.};
GLfloat white[4] = {1., 1., 1., 1.};
GLfloat black[4] = {0., 0., 0., 0.};

glEnable (GL_LIGHTING);
glEnable (GL_COLOR_MATERIAL);
glColorMaterial (GL_FRONT, GL_AMBIENT_AND_DIFFUSE);

glEnable (GL_LIGHT1);
glLightfv (GL_LIGHT1, GL_POSITION, pos);
glLightfv (GL_LIGHT1, GL_DIFFUSE, white);
glLightfv (GL_LIGHT1, GL_SPECULAR, black);

glMaterialfv (GL_FRONT, GL_SPECULAR, black);


Original issue reported on code.google.com by aapo.rantalainen on 28 Jun 2008 at 11:49

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.