Aller au contenu

Mathc matrices/a135

Un livre de Wikilivres.


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.

cc01.c
/* ------------------------------------ */
/*  Save as :   cc01.c                  */
/* ------------------------------------ */
#include      "v_a.h"
#include  "d_strct.h"
#include "d_lastr1.h"
#include    "d_guv.h"
/* ------------------------------------ */
#define        N  (2*C5)
#define    ALPHA  (45.)
/* ------------------------------------ */
void fun(void)
{
double u[N] ={0,5,5,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  =            eye_mR(  i_mR(R3,C3));
double **Ut = c_mR(U,lastr_1_mR(  i_mR(R3,C5)));
double **Vt =                     i_mR(R3,C5);

  c_s_mR(tan(PI/180.*ALPHA),T,R1,C2);

  clrscrn();
  printf("\n Shearing along the x-axis : tan(%.f) : \n",ALPHA);
  printf("\n               | 1  tan(alpha)  0 |       ");
  printf("\n          v  = | 0      1       0 |  u    ");
  printf("\n               | 0      0       1 |   \n\n");

  printf(" T:");
  p_mR(T,S8,P2,C10);

  printf(" U:");
  p_mR(U,S8,P2,C10);

  printf(" V:");
  mul_mR(T,Ut,Vt);
  c_nr_mR(Vt,R2,V);
  p_mR(V,S8,P2,C10);

  G_uv_mR(i_WGnuplot(-20,20,-10,10),Ut,Vt);

  printf("  * open the file main.plt with Gnuplot. \n\n");
  stop();
  
  f_mR(U);
  f_mR(V);
  f_mR(T);
  f_mR(Ut);
  f_mR(Vt);
}
/* ------------------------------------ */
void hello(void)
{
  printf("\n\n\n                                              ");
  printf("\n          Shearing along the x-axis :             ");
  printf("\n          *************************               ");
  printf("\n\n                                                ");
  printf("\n\n                                                ");
  printf("\n               | 1  tan(alpha)  0 |               ");
  printf("\n          v  = | 0      1       0 |  u            ");
  printf("\n               | 0      0       1 |           \n\n");
  printf("\n\n                                                ");
  printf("\n\n                                                ");
  printf("                                          \n\n\n\n\n");
  stop();
}
/* ------------------------------------ */
int main(void)
{
  hello();
    fun();
    
  return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
cc02.c
/* ------------------------------------ */
/*  Save as :   cc02.c                  */
/* ------------------------------------ */
#include      "v_a.h"
#include  "d_strct.h"
#include "d_lastr1.h"
#include    "d_guv.h"
/* ------------------------------------ */
#define        N  (2*C5)
#define    ALPHA  (45.)
/* ------------------------------------ */
void fun(void)
{
double u[N] ={0,6,6,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(R3,C5)));
double **Vt =                     i_mR(R3,C5);

 c_s_mR(tan(PI/180.*ALPHA),T,R2,C1);

  clrscrn();
  printf("\n Shearing along the y-axis : tan(%.f) :   \n",ALPHA);
  printf("\n               | 1          0   0 |         ");
  printf("\n          v  = | tan(alpha) 1   0 |  u      ");
  printf("\n               | 0          0   1 |     \n\n");

  printf(" T:");
  p_mR(T,S8,P2,C10);

  printf(" U:");
  p_mR(U,S8,P2,C10);


  printf(" V:");
  mul_mR(T,Ut,Vt);
  c_nr_mR(Vt,R2,V);
  p_mR(V,S8,P2,C10);

  G_uv_mR(i_WGnuplot(-20,20,-10,10),Ut,Vt);

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

  f_mR(U);
  f_mR(V);
  f_mR(T);
  f_mR(Ut);
  f_mR(Vt);
}
/* ------------------------------------ */
void hello(void)
{
  printf("\n Freeware by : xhunga bernard 06000 Nice France.  ");
  printf("\n\n\n                                              ");
  printf("\n          Shearing along the y-axis :             ");
  printf("\n          *************************               ");
  printf("\n\n                                                ");
  printf("\n\n                                                ");
  printf("\n               |     1      0       0 |           ");
  printf("\n          v  = | tan(alpha) 1       0 |  u        ");
  printf("\n               |     0      0       1 |       \n\n");
  printf("\n\n                                                ");
  printf("\n\n                                                ");
  printf("                                          \n\n\n\n\n");
  stop();
}
/* ------------------------------------ */
int main(void)
{
  hello();
    fun();
    
  return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */