Beispiel #1
0
        }// end omothetia()

        /// <summary>
        /// scalar product between this and w.
        /// </summary>
        /// <param name="w">the second factor; the first factor is "this"</param>
        /// <returns></returns>
        public double scalarProduct(PointR3 w)
        {
            double scalar = this.getX * w.getX
                            + this.getY * w.getY
                            + this.getZ * w.getZ;

            //
            return(scalar);
        }// end scalarscalarProduct()
Beispiel #2
0
        }// end scalarProduct

        /// <summary>
        /// vector product between this and w, assuminig both in the x-y plane, i.e. z==0.
        /// </summary>
        /// <param name="w">the second factor; the first factor is "this"; the result will have the form (0,0,k) with k in R.</param>
        /// <returns></returns>
        public PointR3 vectorProduct(PointR2 w)
        {
            PointR3 v_inR3        = new PointR3(this.x, this.y, 0);
            PointR3 w_inR3        = new PointR3(w.x, w.y, 0);
            PointR3 external_inR3 = v_inR3.vectorProduct(w_inR3);

            //ready
            return(external_inR3);
        } // end vectorProduct()
Beispiel #3
0
        }// end getPointCoordinates

        /// <summary>
        /// product of a scalar for a vector, i.e. omothetia of a vector.
        /// </summary>
        public PointR3 omothetia(double theScalar)
        {
            LinearAlgebra.PointR3 stretchedVector = new PointR3(
                this.getX * theScalar,
                this.getY * theScalar,
                this.getZ * theScalar
                );
            return(stretchedVector);
        }// end omothetia()
Beispiel #4
0
        }// getCoordinates


        /// <summary>
        /// scalar product between this and w.
        /// </summary>
        /// <param name="w">the second factor; the first factor is "this"</param>
        /// <returns></returns>
        public double scalarProduct(PointR2 w)
        {
            PointR3 v_inR3      = new PointR3(this.x, this.y, 0);
            PointR3 w_inR3      = new PointR3(w.x, w.y, 0);
            double  scalar_inR3 = v_inR3.scalarProduct(w_inR3);

            // ready.
            return(scalar_inR3);
        }// end scalarProduct
Beispiel #5
0
        }// end NormaEuclidea

        /// <summary>
        /// vector product between this and w.
        /// </summary>
        /// <param name="w">the second factor; the first factor is "this"</param>
        /// <returns></returns>
        public PointR3 vectorProduct(PointR3 w)
        {
            double[,] externalProductTensor = new double[3, 3];
            double imageX, imageY, imageZ;

            // first row is dynamical: it will contain {e1, e2, e3}, once each.
            // second row is {this.x, this.y, this.z}
            // third row is {w.x, w.y, w.z}
            //
            externalProductTensor[0, 0] = 1.0;
            externalProductTensor[0, 1] = 0.0;
            externalProductTensor[0, 2] = 0.0;
            //
            externalProductTensor[1, 0] = this.x;
            externalProductTensor[1, 1] = this.y;
            externalProductTensor[1, 2] = this.z;
            //
            externalProductTensor[2, 0] = w.x;
            externalProductTensor[2, 1] = w.y;
            externalProductTensor[2, 2] = w.z;
            //
            LinearAlgebra.RealMatrix firstMatrix = new RealMatrix(externalProductTensor, 3, 3);
            imageX = firstMatrix.det();
            //
            externalProductTensor[0, 0] = 0.0;
            externalProductTensor[0, 1] = 1.0;
            externalProductTensor[0, 2] = 0.0;
            //
            LinearAlgebra.RealMatrix secondMatrix = new RealMatrix(externalProductTensor, 3, 3);
            imageY = secondMatrix.det();
            //
            externalProductTensor[0, 0] = 0.0;
            externalProductTensor[0, 1] = 0.0;
            externalProductTensor[0, 2] = 1.0;
            //
            LinearAlgebra.RealMatrix thirdMatrix = new RealMatrix(externalProductTensor, 3, 3);
            imageZ = thirdMatrix.det();
            //
            PointR3 vectorProductImage = new PointR3(imageX, imageY, imageZ);

            //ready
            return(vectorProductImage);
        } // end vectorProduct()