Mathc matrices/08z
Apparence
Installer et compiler ces fichiers dans votre répertoire de travail.
c00e.c |
|---|
/* ------------------------------------ */
/* Save as : c00e.c */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
#define RAb R2
#define CA C3
#define Cb C1
#define Rv C3
/* ------------------------------------ */
# define FREEV C1
/* ------------------------------------ */
int main(void)
{
double ab[RAb*(CA+Cb)]={
+4, +3, -1, -0, /* V1|0 See c00a.c */
-1, -1, +2, -0 /* V2|0 */
};
double Projp[Rv*C1] ={
-6.454545454546,
-6.272727272728,
+11.636363636364
};
double **Ab = ca_A_mR(ab, i_Abr_Ac_bc_mR(RAb, CA, Cb));
double **Ab_free = i_Abr_Ac_bc_mR(CA, CA, Cb + FREEV);
double **b_free = i_mR(CA, Cb + FREEV);
double **A = c_Ab_A_mR(Ab, i_mR(RAb, CA));
double **At = transpose_mR(A, i_mR(CA, RAb));
double **vPp = ca_A_mR(Projp, i_mR(Rv,C1));
double **v1 = i_mR(Rv,C1);
double **v2 = i_mR(Rv,C1);
double **vQ = i_mR(Rv,C1);
/* Compute the free variables (b_free) */
gj_PP_mR(Ab,NO);
put_zeroR_mR(Ab,Ab_free);
put_freeV_mR(Ab_free);
gj_PP_mR(Ab_free,YES);
c_Ab_b_mR(Ab_free,b_free);
clrscrn();
printf(" Compute the orthogonal vectors to: (See c00a .c)\n\n"
" v1:");
p_mR(c_c_mR(At,(C1), v1,C1), S10,P4,C1);
printf(" v2:");
p_mR(c_c_mR(At,(C2), v2,C1), S10,P4,C1);
printf(" vQ is orthogonal to the vectors v1 and v2.\n\n"
" The equation of a plan defined by v1 and v2\n"
" is ax + by + cz=0, where a,b,c are the coordinates\n"
" of the vector orthogonal (vQ).\n\n"
" vQ:");
p_mR(c_c_mR(b_free,C2, vQ,C1), S10,P12,C1);
stop();
clrscrn();
printf(" vPp is the projection of a point P onto the plan (See c00d.c)\n\n"
" vPp:");
p_mR(vPp, S10,P12,C1);
printf(" vQ is orthogonal to the plan defined by the vectors v1 and v2.\n\n"
" vQ:");
p_mR(vQ, S10,P12,C1);
printf(" dot(vPp,vQ) = %.9f\n\n"
" The dot product of vQ and vPp say that the vector vPp \n"
" is orthogonal to the vector vQ. Then the point p is in\n"
" the plan v1 and v2.\n\n",
dot_R(vPp,vQ));
stop();
f_mR(Ab);
f_mR(Ab_free);
f_mR(b_free);
f_mR(v1);
f_mR(v2);
f_mR(vQ);
return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
Vérifiez si la projection d'un point P appartient au plan. Si la projection du point P, le vecteur vPp, est perpendiculaire au vecteur vQ, alors le produit scalaire de ces deux vecteurs est nul et le point Pp est bien dans le plan.
Exemple de sortie écran :
Compute the orthogonal vectors to: (See c00a .c)
v1:
+4.0000
+3.0000
-1.0000
v2:
-1.0000
-1.0000
+2.0000
vQ is orthogonal to the vectors v1 and v2.
The equation of a plan defined by v1 and v2
is ax + by + cz=0, where a,b,c are the coordinates
of the vector orthogonal (vQ).
vQ:
-5.000000000000
+7.000000000000
+1.000000000000
Press return to continue.
vPp is the projection of a point P onto the plan (See c00d.c)
vPp:
-6.454545454546
-6.272727272728
+11.636363636364
vQ is orthogonal to the plan defined by the vectors v1 and v2.
vQ:
-5.000000000000
+7.000000000000
+1.000000000000
dot(vPp,vQ) = -0.000000000
The dot product of vQ and vPp say that the vector vPp
is orthogonal to the vector vQ. Then the point p is in
the plan v1 and v2.
Press return to continue.