Application


Installer et compiler ces fichiers c dans votre répertoire de travail.


Vous trouverez le code source et le fichier graphique correspondant à chaque transformation.

L'étude des matrices de transformation fait partie d'un cours de mathématiques et sort du cadre de ce livre.

cf01.c
/* ------------------------------------ */
/*  Save as :   cf01.c                  */
/* ------------------------------------ */
#include      "v_a.h"
#include  "d_strct.h"
#include "d_lastr1.h"
#include "d_gtrans.h"
#include     "d_gv.h"
/* ------------------------------------ */
#define N   (2*C5)
#define TX  (10.)
#define TY  (10.)
/* ------------------------------------ */
void fun(void)
{
double u[N] ={0,2,2,0,0,
              0,0,4,4,0 };
              
double **U  =           ca_A_mR(u,i_mR(R2,C5));
double **V  =                     i_mR(R2,C5);
double **T  =            eye_mR(  i_mR(R3,C3));
double **Ut = c_mR(U,lastr_1_mR(  i_mR(C3,C5)));
double **Vt =                     i_mR(C3,C5);

     c_s_mR(-TX,T,R1,C3);
     c_s_mR(-TY,T,R2,C3);

  clrscrn();
  printf("\n Translated change of axes :   xt:%.0f  yt:%.0f \n",TX,TY);
  printf("\n               | 1      0     -xt |               ");
  printf("\n          v  = | 0      1     -yt |  u            ");
  printf("\n               | 0      0       1 |           \n\n");

  printf(" T:");
  p_mR(T,S5,P3,C9);

  printf(" U:");
  p_mR(U,S3,P0,C9);

  printf(" V:");
  mul_mR(T,Ut,Vt);
  p_mR(c_nr_mR(Vt,R2,V),S3,P0,C9);

  G_translateAxes_mR(i_WGnuplot(-20,20,-20,20),U,TX,TY);

  printf("  * open the file main.plt with Gnuplot.\n\n\n");
  stop();

  clrscrn();
  printf(" The graph into the new coordinate system.\n\n");
  printf(" V:");
  p_mR(V,3,0,C9);

  G_v_mR(i_WGnuplot(-20,20,-20,20),V);

  printf("  * open the file main.plt with Gnuplot.\n\n\n");
  stop();

  f_mR(T);
  f_mR(U);
  f_mR(Ut);
  f_mR(V);
  f_mR(Vt);
}
/* ------------------------------------ */
void hello(void)
{
  printf("\n\n\n                                              ");
  printf("\n          Translated change of axes :             ");
  printf("\n          *************************               ");
  printf("\n\n                                                ");
  printf("\n\n                                                ");
  printf("\n               | 1      0     -xt |               ");
  printf("\n          v  = | 0      1     -yt |  u            ");
  printf("\n               | 0      0       1 |           \n\n");
  printf("\n\n                                                ");
  printf("                                          \n\n\n\n\n");
  stop();
}
/* ------------------------------------ */
int main(void)
{
  hello();
    fun();
    
  return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
cf02.c
/* ------------------------------------ */
/*  Save as :   cf02.c                  */
/* ------------------------------------ */
#include      "v_a.h"
#include  "d_strct.h"
#include "d_lastr1.h"
#include "d_grotat.h"
#include     "d_gv.h"
/* ------------------------------------ */
#define        N  (2*C5)
#define    ALPHA  (45.)
/* ------------------------------------ */
void fun(void)
{
double u[N] ={0,6,6,0,0,
              0,0,6,6,0};

double **U  =             ca_A_mR(u,i_mR(R2,C5));
double **V  =                       i_mR(R2,C5);
double **T  =     Rot2D_mR(eye_mR(  i_mR(R3,C3)),PI/180.*ALPHA);
double **Ut =   c_mR(U,lastr_1_mR(  i_mR(R3,C5)));
double **Vt =                       i_mR(R3,C5);

  clrscrn();
  printf("\n  Rotated change R_SIZE axes :   alpha:%.0fdeg \n",ALPHA);
  printf("\n               |  cos(a) sin(a) 0 |               ");
  printf("\n          v  = | -sin(a) cos(a) 0 |  u            ");
  printf("\n               |      0      0  1 |           \n\n");

  printf(" T:");
  p_mR(T,S5,P3,C9);

  printf(" U:");
  p_mR(U,S3,P2,C9);

  printf(" V:");
  mul_mR(T,Ut,Vt);
  p_mR(c_nr_mR(Vt,2,V),S3,P2,C9);

  G_rotateAxes_mR(i_WGnuplot(-10,10,-10,10),U,ALPHA);

  printf("  * open the file main.plt with Gnuplot.\n\n\n");
  stop();

  clrscrn();
  printf(" The graph into the new coordinate system.\n\n");
  printf(" V:");
  p_mR(V,3,2,C9);

  G_v_mR(i_WGnuplot(-10,10,-10,10),V);

  printf("  * open the file main.plt with Gnuplot.\n\n\n");
  stop();

  f_mR(T);
  f_mR(U);
  f_mR(Ut);
  f_mR(V);
  f_mR(Vt);
}
/* ------------------------------------ */
void hello(void)
{
  printf("\n\n\n                                              ");
  printf("\n            Rotated change R_SIZE axes :          ");
  printf("\n           ************************               ");
  printf("\n\n                                                ");
  printf("\n\n                                                ");
  printf("\n               |  cos(a) sin(a) 0 |               ");
  printf("\n          v  = | -sin(a) cos(a) 0 |  u            ");
  printf("\n               |      0      0  1 |           \n\n");
  printf("\n\n                                                ");
  printf("                                          \n\n\n\n\n");
  stop();
}
/* ------------------------------------ */
int main(void)
{
  hello();
    fun();
    
  return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */