Aller au contenu

Mathc matrices/a132

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.

ca01.c
/* ------------------------------------ */
/*  Save as :   ca01.c                  */
/* ------------------------------------ */
#include      "v_a.h"
#include  "d_strct.h"
#include "d_lastr1.h"
#include    "d_guv.h"
/* ------------------------------------ */
#define        N  (2*C5)
#define  SHIFT_H  (+4.)
/* ------------------------------------ */
void fun(void)
{
double u[N] ={0,3,3,0,0,
              0,0,5,5,0 };
              
double **U  = ca_A_mR(u,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(SHIFT_H,T,R1,C3);

  clrscrn();
  printf(" SHIFT_H = %+.2f \n\n\n",SHIFT_H);
  printf(" T:\n");
  p_mR(T,S5,P0,C9);
  printf(" U:\n");
  p_mR(U,S3,P0,C9);
  mul_mR(T,Ut,Vt);

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

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

  f_mR(U);
  f_mR(T);
  f_mR(Ut);
  f_mR(Vt);
}
/* ------------------------------------ */
void hello(void)
{
  printf("\n\n\n                                              ");
  printf("\n  Horizontal shift (left H < 0, right H > 0)  :   ");
  printf("\n       ******************************             ");
  printf("\n\n                                                ");
  printf("\n\n                                                ");
  printf("\n                | 1  0  H |                       ");
  printf("\n           v  = | 0  1  0 |  u                    ");
  printf("\n                | 0  0  1 |                       ");
  printf("                                          \n\n\n\n\n");
  stop();
}
/* ------------------------------------ */
int main(void)
{
  hello();
    fun();
    
  return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
ca02.c
/* ------------------------------------ */
/*  Save as :   ca02.c                  */
/* ------------------------------------ */
#include      "v_a.h"
#include  "d_strct.h"
#include "d_lastr1.h"
#include    "d_guv.h"
/* ------------------------------------ */
#define        N  (2*C5)
#define  SHIFT_V  (-6.)
/* ------------------------------------ */
void fun(void)
{
double u[N] ={0,3,3,0,0,
              0,0,5,5,0 };
              
double **U  = ca_A_mR(u,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(SHIFT_V,T,R2,C3);

  clrscrn();
  printf(" SHIFT_V = %+.2f \n\n\n",SHIFT_V);
  printf(" T:\n");
  p_mR(T,S5,P0,C9);

  printf(" U:\n");
  p_mR(U,S3,P0,C9);
  mul_mR(T,Ut,Vt);

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

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

  f_mR(U);
  f_mR(T);
  f_mR(Ut);
  f_mR(Vt);
}
/* ------------------------------------ */
void hello(void)
{
  printf("\n\n\n                                              ");
  printf("\n    Vertical shift (down V < 0, up V > 0)  :      ");
  printf("\n       ******************************             ");
  printf("\n\n                                                ");
  printf("\n\n                                                ");
  printf("\n                | 1  0  0 |                       ");
  printf("\n           v  = | 0  1  V |  u                    ");
  printf("\n                | 0  0  1 |                       ");
  printf("                                          \n\n\n\n\n");
  stop();
}
/* ------------------------------------ */
int main(void)
{
  hello();
    fun();
    
  return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
ca03.c
/* ------------------------------------ */
/*  Save as :   ca03.c                  */
/* ------------------------------------ */
#include      "v_a.h"
#include  "d_strct.h"
#include "d_lastr1.h"
#include    "d_guv.h"
/* ------------------------------------ */
#define        N  (2*C5)
#define  SHIFT_H  (+4.)
#define  SHIFT_V  (-6.)
/* ------------------------------------ */
void fun(void)
{
double u[N] ={0,3,3,0,0,
              0,0,5,5,0 };
              
double **U  = ca_A_mR(u,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(SHIFT_H,T,R1,C3);
  c_s_mR(SHIFT_V,T,R2,C3);

  clrscrn();
  printf(" SHIFT_H = %+.2f     \n",SHIFT_H);
  printf(" SHIFT_V = %+.2f \n\n\n",SHIFT_V);
  printf(" T:\n");
  p_mR(T,S5,P0,C9);
  printf(" U:\n");
  p_mR(U,S3,P0,C9);
  mul_mR(T,Ut,Vt);

  G_uv_mR(i_WGnuplot(-10,10,-10,10),
                Ut,Vt);
                
  printf("  * open the file main.plt with Gnuplot.\n\n\n");
  stop();

  f_mR(U);
  f_mR(T);
  f_mR(Ut);
  f_mR(Vt);
}
/* ------------------------------------ */
void hello(void)
{
  printf("\n\n\n                                              ");
  printf("\n       Horizontal and Vertical shift  :           ");
  printf("\n       *****************************              ");
  printf("\n\n                                                ");
  printf("\n\n                                                ");
  printf("\n                | 1  0  H |                       ");
  printf("\n           v  = | 0  1  V |  u                    ");
  printf("\n                | 0  0  1 |                       ");
  printf("                                          \n\n\n\n\n");
  stop();
}
/* ------------------------------------ */
int main(void)
{
  hello();
    fun();
    
  return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */