/*************************************************************************************************************************************/
/* */
/* N O E U D D E T R E F L E : */
/* */
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* * * * ** * * * * * ** * */
/* * * * * * * * * * * * * * * * */
/* * * * * * * * * * * * * * */
/* * * * * * * * * * * * * * * * */
/* * * * * * * * * * * * * * * * */
/* * * * * * * * * * * * * * * * * * */
/* * * * * * * * * * * * * * */
/* * * * * * * * * * * * * * * * */
/* * * * * ** * * * * * ** */
/* * * * * * * * * * * * * * * * * * * * * * * */
/* */
/* */
/* ATTENTION : */
/* */
/* Ce programme '$c' est utilise dans */
/* 'v $xigP/NoeudTrefle.01$Z NoeudTrefle.01$c'. */
/* Il est donc preferable d'etre prudent en cas */
/* de modification... */
/* */
/* */
/* Author of '$xtc/NoeudTrefle.01$c' : */
/* */
/* Jean-Francois COLONNA (LACTAMME, 20220428125054). */
/* */
/*************************************************************************************************************************************/
#include "INCLUDES.01.I"
#define FACTEUR \
2.6314
/* Facteur permettant d'ajuster le nombre de points generes (256...). */
#define R1 \
1
#define R2 \
(1.0/4.0)
/* Definition geometrique du tore ('v $xrs/tore.12$I'). */
#define Umin \
0
#define Umax \
DEUX_PI
#define Vmin \
0
#define Vmax \
DEUX_PI
/* Definition de l'espace {u,v} du tore ('v $xrs/tore.14$I'). */
#define A \
(3.0/2.0)
#define B \
0
#define Tmin \
0.0
#define Tmax \
((2*DEUX_PI)-1.16637061435917)
#define Tpas \
(FACTEUR*0.02250)
/* Definition de la droite de pente rationnelle dans l'espace {u,v} du tore, mais n'allant */
/* pas jusqu'au "bout" afin que le noeud soit "ouvert"... */
#define Lmin \
0.0
#define Lmax \
1.0
#define Lpas1 \
(FACTEUR*0.0160)
#define Lpas3 \
(FACTEUR*0.0100)
/* Definition des jonctions du noeud aux points {0,0,0} et {0,0,1}. */
double permutation_XX=0;
double permutation_XY=0;
double permutation_XZ=+1;
double translation_X=0;
double permutation_YX=0;
double permutation_YY=+1;
double permutation_YZ=0;
double translation_Y=0;
double permutation_ZX=+1;
double permutation_ZY=0;
double permutation_ZZ=0;
double translation_Z=0;
#define PRINT(message,x,y,z) \
{ \
printf("%s X=%f Y=%f Z=%f\n" \
,message \
,LIN3(permutation_XX,x \
,permutation_XY,y \
,permutation_XZ,z \
,translation_X \
) \
,LIN3(permutation_YX,x \
,permutation_YY,y \
,permutation_YZ,z \
,translation_Y \
) \
,LIN3(permutation_ZX,x \
,permutation_ZY,y \
,permutation_ZZ,z \
,translation_Z \
) \
); \
}
double Fx(u,v)
double u,v;
{
return((R1+R2*cos(u))*cos(v));
}
/* Definition de la coordonnee 'X(u,v)' du tore ('v $xrs/tore.11$I'). */
double Fy(u,v)
double u,v;
{
return((R1+R2*cos(u))*sin(v));
}
/* Definition de la coordonnee 'Y(u,v)' du tore ('v $xrs/tore.11$I'). */
double Fz(u,v)
double u,v;
{
return(R2*sin(u));
}
/* Definition de la coordonnee 'Z(u,v)' du tore ('v $xrs/tore.11$I'). */
void main()
{
double t;
double x0,y0,z0;
double x1,y1,z1;
double lambda;
int compteur=0;
for (t=Tmin ; t<=Tmax ; t=t+Tpas)
{
double tc=(A*t)+B;
double u,v;
u = t;
v = tc-PI_SUR_2;
/* Parcours de la droite de pente rationnelle dans l'espace {u,v} du tore. */
x1 = 0.5+(Fx(u,v)/(2*(R1+R2)));
y1 = 0.5+(Fy(u,v)/(2*(R1+R2)));
z1 = 0.5+(Fz(u,v)/(2*(R2)));
/* Generation du point {u,v} du tore. */
if (t == Tmin)
{
x0 = x1;
y0 = y1;
z0 = z1;
/* Memorisation du premier point du noeud {x0,y0,z0} sur le tore. */
}
else
{
}
PRINT("Troncon2",x1,y1,z1);
compteur++;
}
/* Le point {x1,y1,z1} est le dernier point du noeud sur le tore. */
for (lambda=Lmin ; lambda<=Lmax ; lambda=lambda+Lpas1)
{
double x,y,z;
x=BARY(0.0,x0,lambda);
y=BARY(0.0,y0,lambda);
z=BARY(0.0,z0,lambda);
/* Jonction lineaire entre {0,0,0} et {x0,y0,z0}. */
PRINT("Troncon1",x,y,z);
compteur++;
}
for (lambda=Lmin ; lambda<=Lmax ; lambda=lambda+Lpas3)
{
double x,y,z;
x=BARY(x1,0.0,lambda);
y=BARY(y1,0.0,lambda);
z=BARY(z1,1.0,lambda);
/* Jonction lineaire entre {0,0,1} et {x1,y1,z1}. */
PRINT("Troncon3",x,y,z);
compteur++;
}
if (compteur != COULEURS)
{
printf("Le nombre de points vaut %d, alors qu'il faudrait %d.\n",compteur,COULEURS);
/* Permet de verifier que le noeud "ouvert" est defini par 256 points... */
}
}