コード例 #1
0
        public void projectionYZ()
        {
            Matrice m = new Matrice();

            m.setIdentite(0, 1, 1);        //Matrice de projection

            this.multiply(m);              //Application de la projection
        }
コード例 #2
0
        public void scale(double kx, double ky, double kz)
        {
            Matrice m = new Matrice();

            m.setIdentite(kx, ky, kz);     //Création matrice de scale

            this.multiply(m);              //Application du scale
        }
コード例 #3
0
        public Matrice getComatrice()
        {
            Vecteur3 l1 = new Vecteur3(this.getCofacteur(1, 1), this.getCofacteur(1, 2), this.getCofacteur(1, 3));
            Vecteur3 l2 = new Vecteur3(this.getCofacteur(2, 1), this.getCofacteur(2, 2), this.getCofacteur(2, 3));
            Vecteur3 l3 = new Vecteur3(this.getCofacteur(3, 1), this.getCofacteur(3, 2), this.getCofacteur(3, 3));
            Matrice  m  = new Matrice(l1, l2, l3);

            return(m.transpose());
        }
コード例 #4
0
        public void cisailleYZ(double s, double t)
        {
            Vecteur3 l1 = new Vecteur3(1, s, t);
            Vecteur3 l2 = new Vecteur3(0, 1, 0);
            Vecteur3 l3 = new Vecteur3(0, 0, 1);
            Matrice  m  = new Matrice(l1, l2, l3); //Création matrice de cisaillement

            this.multiply(m);                      //Application du cisaillement
        }
コード例 #5
0
        public void reflexion(Vecteur3 n)
        {
            Vecteur3 l1 = new Vecteur3(1 - 2 * n.x * n.x, -2 * n.x * n.y, -2 * n.x * n.z);
            Vecteur3 l2 = new Vecteur3(-2 * n.x * n.y, 1 - 2 * n.y * n.y, -2 * n.y * n.z);
            Vecteur3 l3 = new Vecteur3(-2 * n.x * n.z, -2 * n.y * n.z, 1 - 2 * n.z * n.z);
            Matrice  m  = new Matrice(l1, l2, l3); //Création de la matrice de réflexion

            this.multiply(m);                      //Application de la reflexion
        }
コード例 #6
0
        public void projectionN(Vecteur3 n)
        {
            Vecteur3 l1 = new Vecteur3(1 - n.x * n.x, -n.x * n.y, -n.x * n.z);
            Vecteur3 l2 = new Vecteur3(-n.x * n.y, 1 - n.y * n.y, -n.y * n.z);
            Vecteur3 l3 = new Vecteur3(-n.x * n.z, -n.z * n.y, 1 - n.z * n.z);
            Matrice  m  = new Matrice(l1, l2, l3); //Matrice de projection celon n

            this.multiply(m);                      //Application de la projection
        }
コード例 #7
0
        public bool isOrthogonale()
        {
            Matrice m1 = new Matrice(this.l1, this.l2, this.l3);
            Matrice m2 = new Matrice(this.l1, this.l2, this.l3);

            m2 = m2.transpose();
            m1.multiply(m2);
            m2.setIdentite();
            return(m1.egal(m2));
        }
コード例 #8
0
        public void rotateZ(double angle)
        {
            //Création matrice de rotation
            Vecteur3 l1            = new Vecteur3(Math.Cos(angle), Math.Sin(angle), 0);
            Vecteur3 l2            = new Vecteur3(-Math.Sin(angle), Math.Cos(angle), 0);
            Vecteur3 l3            = new Vecteur3(0, 0, 1);
            Matrice  rotateMatrice = new Matrice(l1, l2, l3);

            //rotation
            this.multiply(rotateMatrice);
        }
コード例 #9
0
        public Matrice transpose()
        {
            Matrice  res   = new Matrice();
            Vecteur3 resL1 = new Vecteur3(this.l1.x, this.l2.x, this.l3.x);             //Création des valeurs transposées à chaque ligne de la matrice
            Vecteur3 resL2 = new Vecteur3(this.l1.y, this.l2.y, this.l3.y);
            Vecteur3 resL3 = new Vecteur3(this.l1.z, this.l2.z, this.l3.z);

            res.l1 = resL1;
            res.l2 = resL2;
            res.l3 = resL3;
            return(res);
        }
コード例 #10
0
        public Matrice getInverse()
        {
            double deter = this.getDeterminant();

            if (deter == 0)
            {
                throw new System.ArgumentException("Déterminant = 0");
            }
            Matrice m = this.getComatrice();

            m.divideK(deter);
            return(m);
        }
コード例 #11
0
        public void scaleN(Vecteur3 n, double k)
        {
            Vecteur3 l1 = new Vecteur3(1 + (k - 1) * n.x * n.x,
                                       (k - 1) * n.x * n.y,
                                       (k - 1) * n.x * n.z);
            Vecteur3 l2 = new Vecteur3((k - 1) * n.x * n.y,
                                       1 + (k - 1) * n.y * n.y,
                                       (k - 1) * n.y * n.z);
            Vecteur3 l3 = new Vecteur3((k - 1) * n.z * n.x,
                                       (k - 1) * n.z * n.y,
                                       1 + (k - 1) * n.z * n.z);
            Matrice m = new Matrice(l1, l2, l3); //Création matrice scale

            this.multiply(m);                    //Application du scale
        }
コード例 #12
0
        public void rotateN(Vecteur3 n, double angle)
        {
            Vecteur3 l1 = new Vecteur3(n.x * n.x * (1 - Math.Cos(angle)) + Math.Cos(angle),
                                       n.x * n.y * (1 - Math.Cos(angle)) + n.z * Math.Sin(angle),
                                       n.x * n.z * (1 - Math.Cos(angle)) - n.y * Math.Sin(angle));

            Vecteur3 l2 = new Vecteur3(n.x * n.y * (1 - Math.Cos(angle)) - n.z * Math.Sin(angle),
                                       n.y * n.y * (1 - Math.Cos(angle)) + Math.Cos(angle),
                                       n.y * n.z * (1 - Math.Cos(angle)) + n.x * Math.Sin(angle));

            Vecteur3 l3 = new Vecteur3(n.x * n.z * (1 - Math.Cos(angle)) + n.y * Math.Sin(angle),
                                       n.y * n.z * (1 - Math.Cos(angle)) - n.x * Math.Sin(angle),
                                       n.z * n.z * (1 - Math.Cos(angle)) + Math.Cos(angle));
            Matrice m = new Matrice(l1, l2, l3); //Création de la matrice de rotation

            this.multiply(m);                    //On applique la matrice de rotation
        }
コード例 #13
0
        public void multiply(Matrice m)
        {
            Vecteur3 l1 = new Vecteur3();
            Vecteur3 l2 = new Vecteur3();
            Vecteur3 l3 = new Vecteur3();

            l1.x = this.l1.x * m.l1.x + this.l1.y * m.l2.x + this.l1.z * m.l3.x;
            l1.y = this.l1.x * m.l1.y + this.l1.y * m.l2.y + this.l1.z * m.l3.y;
            l1.z = this.l1.x * m.l1.z + this.l1.y * m.l2.z + this.l1.z * m.l3.z;

            l2.x = this.l2.x * m.l1.x + this.l2.y * m.l2.x + this.l2.z * m.l3.x;
            l2.y = this.l2.x * m.l1.y + this.l2.y * m.l2.y + this.l2.z * m.l3.y;
            l2.z = this.l2.x * m.l1.z + this.l2.y * m.l2.z + this.l2.z * m.l3.z;

            l3.x = this.l3.x * m.l1.x + this.l3.y * m.l2.x + this.l3.z * m.l3.x;
            l3.y = this.l3.x * m.l1.y + this.l3.y * m.l2.y + this.l3.z * m.l3.y;
            l3.z = this.l3.x * m.l1.z + this.l3.y * m.l2.z + this.l3.z * m.l3.z;

            this.l1 = l1;
            this.l2 = l2;
            this.l3 = l3;
        }
コード例 #14
0
 public void add(Matrice m)
 {
     this.l1.add(m.l1);
     this.l2.add(m.l2);
     this.l3.add(m.l3);
 }
コード例 #15
0
 public bool egal(Matrice m)
 {
     return(this.l1.egal(m.l1) && this.l2.egal(m.l2) && this.l3.egal(m.l3));
 }
コード例 #16
0
 public void minus(Matrice m)
 {
     this.l1.minus(m.l1);
     this.l2.minus(m.l2);
     this.l3.minus(m.l3);
 }