public static Vector4D HandMadeVectorPtrReturnerWrapper()
        {
            Vector4D ret;

            unsafe{
                double* pD = (double*)HandMadeVectorPtrReturner();
                ret = new Vector4D(pD[0], pD[1], pD[2], pD[3]);
                /*ret.X = pD[0];
                ret.Y = pD[1];
                ret.Z = pD[2];
                ret.W = pD[3];*/
                //ret = *(Vector4D*)HandMadeVectorPtrReturner();
            }
            return ret;
        }
Exemple #2
0
 /// <summary>
 /// Subtracts a vector from a scalar.
 /// </summary>
 /// <param name="v">A <see cref="Vector4D"/> instance.</param>
 /// <param name="s">A scalar.</param>
 /// <returns>A new <see cref="Vector4D"/> instance containing the difference.</returns>
 /// <remarks>
 /// result[i] = s - v[i]
 /// </remarks>
 public static Vector4D Subtract(double s, Vector4D v)
 {
     return(new Vector4D(s - v.X, s - v.Y, s - v.Z, s - v.W));
 }
Exemple #3
0
 /// <summary>
 /// Subtracts a vector from a vector.
 /// </summary>
 /// <param name="v">A <see cref="Vector4D"/> instance.</param>
 /// <param name="w">A <see cref="Vector4D"/> instance.</param>
 /// <returns>A new <see cref="Vector4D"/> instance containing the difference.</returns>
 /// <remarks>
 ///	result[i] = v[i] - w[i].
 /// </remarks>
 public static Vector4D Subtract(Vector4D v, Vector4D w)
 {
     return(new Vector4D(v.X - w.X, v.Y - w.Y, v.Z - w.Z, v.W - w.W));
 }
 /// <summary>
 /// Adds two vectors and put the result in the third vector.
 /// </summary>
 /// <param name="u">A <see cref="Vector4D"/> instance.</param>
 /// <param name="v">A <see cref="Vector4D"/> instance</param>
 /// <param name="w">A <see cref="Vector4D"/> instance to hold the result.</param>
 public static void Add(Vector4D u, Vector4D v, ref Vector4D w)
 {
     w.X = u.X + v.X;
     w.Y = u.Y + v.Y;
     w.Z = u.Z + v.Z;
     w.W = u.W + v.W;
 }
 public static extern int HandMadeVectorTaker(ref Vector4D vec);
Exemple #6
0
 /// <summary>
 /// Multiplies a vector by a scalar.
 /// </summary>
 /// <param name="v">A <see cref="Vector4D"/> instance.</param>
 /// <param name="s">A scalar.</param>
 /// <returns>A new <see cref="Vector4D"/> containing the result.</returns>
 public static Vector4D operator*(double s, Vector4D v)
 {
     return(Vector4D.Multiply(v, s));
 }
Exemple #7
0
 /// <summary>
 /// Adds a vector and a scalar.
 /// </summary>
 /// <param name="v">A <see cref="Vector4D"/> instance.</param>
 /// <param name="s">A scalar.</param>
 /// <returns>A new <see cref="Vector4D"/> instance containing the sum.</returns>
 public static Vector4D operator+(double s, Vector4D v)
 {
     return(Vector4D.Add(v, s));
 }
Exemple #8
0
 /// <summary>
 /// Negates a vector.
 /// </summary>
 /// <param name="v">A <see cref="Vector4D"/> instance.</param>
 /// <returns>A new <see cref="Vector4D"/> instance containing the negated values.</returns>
 public static Vector4D Negate(Vector4D v)
 {
     return(new Vector4D(-v.X, -v.Y, -v.Z, -v.W));
 }
 /// <summary>
 /// Divides a scalar by a vector.
 /// </summary>
 /// <param name="v">A <see cref="Vector4D"/> instance.</param>
 /// <param name="s">A scalar</param>
 /// <returns>A new <see cref="Vector4D"/> containing the quotient.</returns>
 /// <remarks>
 /// result[i] = s / v[i]
 /// </remarks>
 public static Vector4D Divide(double s, Vector4D v)
 {
     return new Vector4D(s / v.X, s/ v.Y, s / v.Z, s/ v.W);
 }
 /// <summary>
 /// Divides a vector by a scalar.
 /// </summary>
 /// <param name="v">A <see cref="Vector4D"/> instance.</param>
 /// <param name="s">A scalar</param>
 /// <returns>A new <see cref="Vector4D"/> containing the quotient.</returns>
 /// <remarks>
 /// result[i] = v[i] / s;
 /// </remarks>
 public static Vector4D Divide(Vector4D v, double s)
 {
     return new Vector4D(v.X / s, v.Y / s, v.Z / s, v.W / s);
 }
 /// <summary>
 /// Divides a vector by another vector.
 /// </summary>
 /// <param name="u">A <see cref="Vector4D"/> instance.</param>
 /// <param name="v">A <see cref="Vector4D"/> instance.</param>
 /// <returns>A new <see cref="Vector4D"/> containing the quotient.</returns>
 /// <remarks>
 ///	result[i] = u[i] / v[i].
 /// </remarks>
 public static Vector4D Divide(Vector4D u, Vector4D v)
 {
     return new Vector4D(u.X / v.X, u.Y / v.Y, u.Z / v.Z, u.W / v.W);
 }
 /// <summary>
 /// Tests whether two vectors are approximately equal given a tolerance value.
 /// </summary>
 /// <param name="v">A <see cref="Vector4D"/> instance.</param>
 /// <param name="u">A <see cref="Vector4D"/> instance.</param>
 /// <param name="tolerance">The tolerance value used to test approximate equality.</param>
 /// <returns><see langword="true"/> if the two vectors are approximately equal; otherwise, <see langword="false"/>.</returns>
 public static bool ApproxEqual(Vector4D v, Vector4D u, double tolerance)
 {
     return
         (
         (System.Math.Abs(v.X - u.X) <= tolerance) &&
         (System.Math.Abs(v.Y - u.Y) <= tolerance) &&
         (System.Math.Abs(v.Z - u.Z) <= tolerance) &&
         (System.Math.Abs(v.W - u.W) <= tolerance)
         );
 }
 /// <summary>
 /// Tests whether two vectors are approximately equal using default tolerance value.
 /// </summary>
 /// <param name="v">A <see cref="Vector4D"/> instance.</param>
 /// <param name="u">A <see cref="Vector4D"/> instance.</param>
 /// <returns><see langword="true"/> if the two vectors are approximately equal; otherwise, <see langword="false"/>.</returns>
 public static bool ApproxEqual(Vector4D v, Vector4D u)
 {
     return ApproxEqual(v,u, MathFunctions.EpsilonD);
 }
 /// <summary>
 /// Adds a vector and a scalar and put the result into another vector.
 /// </summary>
 /// <param name="u">A <see cref="Vector4D"/> instance.</param>
 /// <param name="s">A scalar.</param>
 /// <param name="v">A <see cref="Vector4D"/> instance to hold the result.</param>
 public static void Add(Vector4D u, double s, ref Vector4D v)
 {
     v.X = u.X + s;
     v.Y = u.Y + s;
     v.Z = u.Z + s;
     v.W = u.W + s;
 }
Exemple #15
0
 /// <summary>
 /// Divides a vector by a scalar.
 /// </summary>
 /// <param name="v">A <see cref="Vector4D"/> instance.</param>
 /// <param name="s">A scalar</param>
 /// <returns>A new <see cref="Vector4D"/> containing the quotient.</returns>
 /// <remarks>
 /// result[i] = v[i] / s;
 /// </remarks>
 public static Vector4D Divide(Vector4D v, double s)
 {
     return(new Vector4D(v.X / s, v.Y / s, v.Z / s, v.W / s));
 }
Exemple #16
0
 /// <summary>
 /// Multiplies a vector by a scalar.
 /// </summary>
 /// <param name="u">A <see cref="Vector4D"/> instance.</param>
 /// <param name="s">A scalar.</param>
 /// <returns>A new <see cref="Vector4D"/> containing the result.</returns>
 public static Vector4D Multiply(Vector4D u, double s)
 {
     return(new Vector4D(u.X * s, u.Y * s, u.Z * s, u.W * s));
 }
 /// <summary>
 /// Divides a vector by another vector.
 /// </summary>
 /// <param name="u">A <see cref="Vector4D"/> instance.</param>
 /// <param name="v">A <see cref="Vector4D"/> instance.</param>
 /// <param name="w">A <see cref="Vector4D"/> instance to hold the result.</param>
 /// <remarks>
 /// w[i] = u[i] / v[i]
 /// </remarks>
 public static void Divide(Vector4D u, Vector4D v, ref Vector4D w)
 {
     w.X = u.X / v.X;
     w.Y = u.Y / v.Y;
     w.Z = u.Z / v.Z;
     w.W = u.W / v.W;
 }
Exemple #18
0
 /// <summary>
 /// Negates the values of the vector.
 /// </summary>
 /// <param name="v">A <see cref="Vector4D"/> instance.</param>
 /// <returns>A new <see cref="Vector4D"/> instance containing the negated values.</returns>
 public static Vector4D operator-(Vector4D v)
 {
     return(Vector4D.Negate(v));
 }
 /// <summary>
 /// Divides a vector by a scalar.
 /// </summary>
 /// <param name="u">A <see cref="Vector4D"/> instance.</param>
 /// <param name="s">A scalar</param>
 /// <param name="v">A <see cref="Vector4D"/> instance to hold the result.</param>
 /// <remarks>
 /// v[i] = u[i] / s
 /// </remarks>
 public static void Divide(Vector4D u, double s, ref Vector4D v)
 {
     v.X = u.X / s;
     v.Y = u.Y / s;
     v.Z = u.Z / s;
     v.W = u.W / s;
 }
Exemple #20
0
 /// <summary>
 /// Subtracts a scalar from a vector.
 /// </summary>
 /// <param name="v">A <see cref="Vector4D"/> instance.</param>
 /// <param name="s">A scalar.</param>
 /// <returns>A new <see cref="Vector4D"/> instance containing the difference.</returns>
 /// <remarks>
 /// result[i] = v[i] - s
 /// </remarks>
 public static Vector4D operator-(Vector4D v, double s)
 {
     return(Vector4D.Subtract(v, s));
 }
 /// <summary>
 /// Divides a scalar by a vector.
 /// </summary>
 /// <param name="u">A <see cref="Vector4D"/> instance.</param>
 /// <param name="s">A scalar</param>
 /// <param name="v">A <see cref="Vector4D"/> instance to hold the result.</param>
 /// <remarks>
 /// v[i] = s / u[i]
 /// </remarks>
 public static void Divide(double s, Vector4D u, ref Vector4D v)
 {
     v.X = s / u.X;
     v.Y = s / u.Y;
     v.Z = s / u.Z;
     v.W = s / u.W;
 }
Exemple #22
0
 /// <summary>
 /// Divides a scalar by a vector.
 /// </summary>
 /// <param name="v">A <see cref="Vector4D"/> instance.</param>
 /// <param name="s">A scalar</param>
 /// <returns>A new <see cref="Vector4D"/> containing the quotient.</returns>
 /// <remarks>
 /// result[i] = s / v[i]
 /// </remarks>
 public static Vector4D operator/(double s, Vector4D v)
 {
     return(Vector4D.Divide(s, v));
 }
 /// <summary>
 /// Calculates the dot product of two vectors.
 /// </summary>
 /// <param name="u">A <see cref="Vector4D"/> instance.</param>
 /// <param name="v">A <see cref="Vector4D"/> instance.</param>
 /// <returns>The dot product value.</returns>
 public static double Dot(Vector4D u, Vector4D v)
 {
     return (u.X * v.X) + (u.Y * v.Y) + (u.Z * v.Z) + (u.W * v.W);
 }
Exemple #24
0
		/// <summary>
		/// Transforms a given vector by a matrix and put the result in a vector.
		/// </summary>
		/// <param name="matrix">A <see cref="Matrix4D"/> instance.</param>
		/// <param name="vector">A <see cref="Vector4D"/> instance.</param>
		/// <param name="result">A <see cref="Vector4D"/> instance to hold the result.</param>
		public static void Transform(Matrix4D matrix, Vector4D vector, ref Vector4D result)
		{
			result.X = (matrix.M11 * vector.X) + (matrix.M12 * vector.Y) + (matrix.M13 * vector.Z) + (matrix.M14 * vector.W);
			result.Y = (matrix.M21 * vector.X) + (matrix.M22 * vector.Y) + (matrix.M23 * vector.Z) + (matrix.M24 * vector.W);
			result.Z = (matrix.M31 * vector.X) + (matrix.M32 * vector.Y) + (matrix.M33 * vector.Z) + (matrix.M34 * vector.W);
			result.W = (matrix.M41 * vector.X) + (matrix.M42 * vector.Y) + (matrix.M43 * vector.Z) + (matrix.M44 * vector.W);
		}
 /// <summary>
 /// Multiplies a vector by a scalar.
 /// </summary>
 /// <param name="u">A <see cref="Vector4D"/> instance.</param>
 /// <param name="s">A scalar.</param>
 /// <returns>A new <see cref="Vector4D"/> containing the result.</returns>
 public static Vector4D Multiply(Vector4D u, double s)
 {
     return new Vector4D(u.X * s, u.Y * s, u.Z * s, u.W * s);
 }
Exemple #26
0
 /// <summary>
 /// Adds a vector and a scalar.
 /// </summary>
 /// <param name="v">A <see cref="Vector4D"/> instance.</param>
 /// <param name="s">A scalar.</param>
 /// <returns>A new <see cref="Vector4D"/> instance containing the sum.</returns>
 public static Vector4D Add(Vector4D v, double s)
 {
     return(new Vector4D(v.X + s, v.Y + s, v.Z + s, v.W + s));
 }
 /// <summary>
 /// Multiplies a vector by a scalar and put the result in another vector.
 /// </summary>
 /// <param name="u">A <see cref="Vector4D"/> instance.</param>
 /// <param name="s">A scalar.</param>
 /// <param name="v">A <see cref="Vector4D"/> instance to hold the result.</param>
 public static void Multiply(Vector4D u, double s, ref Vector4D v)
 {
     v.X = u.X * s;
     v.Y = u.Y * s;
     v.Z = u.Z * s;
     v.W = u.W * s;
 }
Exemple #28
0
 /// <summary>
 /// Subtracts a scalar from a vector.
 /// </summary>
 /// <param name="v">A <see cref="Vector4D"/> instance.</param>
 /// <param name="s">A scalar.</param>
 /// <returns>A new <see cref="Vector4D"/> instance containing the difference.</returns>
 /// <remarks>
 /// result[i] = v[i] - s
 /// </remarks>
 public static Vector4D Subtract(Vector4D v, double s)
 {
     return(new Vector4D(v.X - s, v.Y - s, v.Z - s, v.W - s));
 }
 /// <summary>
 /// Negates a vector.
 /// </summary>
 /// <param name="v">A <see cref="Vector4D"/> instance.</param>
 /// <returns>A new <see cref="Vector4D"/> instance containing the negated values.</returns>
 public static Vector4D Negate(Vector4D v)
 {
     return new Vector4D(-v.X, -v.Y, -v.Z, -v.W);
 }
Exemple #30
0
 /// <summary>
 /// Divides a vector by another vector.
 /// </summary>
 /// <param name="u">A <see cref="Vector4D"/> instance.</param>
 /// <param name="v">A <see cref="Vector4D"/> instance.</param>
 /// <returns>A new <see cref="Vector4D"/> containing the quotient.</returns>
 /// <remarks>
 ///	result[i] = u[i] / v[i].
 /// </remarks>
 public static Vector4D Divide(Vector4D u, Vector4D v)
 {
     return(new Vector4D(u.X / v.X, u.Y / v.Y, u.Z / v.Z, u.W / v.W));
 }
 /// <summary>
 /// Subtracts a vector from a vector.
 /// </summary>
 /// <param name="v">A <see cref="Vector4D"/> instance.</param>
 /// <param name="w">A <see cref="Vector4D"/> instance.</param>
 /// <returns>A new <see cref="Vector4D"/> instance containing the difference.</returns>
 /// <remarks>
 ///	result[i] = v[i] - w[i].
 /// </remarks>
 public static Vector4D Subtract(Vector4D v, Vector4D w)
 {
     return new Vector4D(v.X - w.X, v.Y - w.Y, v.Z - w.Z, v.W - w.W);
 }
Exemple #32
0
 /// <summary>
 /// Divides a scalar by a vector.
 /// </summary>
 /// <param name="v">A <see cref="Vector4D"/> instance.</param>
 /// <param name="s">A scalar</param>
 /// <returns>A new <see cref="Vector4D"/> containing the quotient.</returns>
 /// <remarks>
 /// result[i] = s / v[i]
 /// </remarks>
 public static Vector4D Divide(double s, Vector4D v)
 {
     return(new Vector4D(s / v.X, s / v.Y, s / v.Z, s / v.W));
 }
 /// <summary>
 /// Subtracts a scalar from a vector.
 /// </summary>
 /// <param name="v">A <see cref="Vector4D"/> instance.</param>
 /// <param name="s">A scalar.</param>
 /// <returns>A new <see cref="Vector4D"/> instance containing the difference.</returns>
 /// <remarks>
 /// result[i] = v[i] - s
 /// </remarks>
 public static Vector4D Subtract(Vector4D v, double s)
 {
     return new Vector4D(v.X - s, v.Y - s, v.Z - s, v.W - s);
 }
Exemple #34
0
 /// <summary>
 /// Calculates the dot product of two vectors.
 /// </summary>
 /// <param name="u">A <see cref="Vector4D"/> instance.</param>
 /// <param name="v">A <see cref="Vector4D"/> instance.</param>
 /// <returns>The dot product value.</returns>
 public static double Dot(Vector4D u, Vector4D v)
 {
     return((u.X * v.X) + (u.Y * v.Y) + (u.Z * v.Z) + (u.W * v.W));
 }
 /// <summary>
 /// Subtracts a vector from a scalar.
 /// </summary>
 /// <param name="v">A <see cref="Vector4D"/> instance.</param>
 /// <param name="s">A scalar.</param>
 /// <returns>A new <see cref="Vector4D"/> instance containing the difference.</returns>
 /// <remarks>
 /// result[i] = s - v[i]
 /// </remarks>
 public static Vector4D Subtract(double s, Vector4D v)
 {
     return new Vector4D(s - v.X, s - v.Y, s - v.Z, s - v.W);
 }
Exemple #36
0
 /// <summary>
 /// Tests whether two vectors are approximately equal using default tolerance value.
 /// </summary>
 /// <param name="v">A <see cref="Vector4D"/> instance.</param>
 /// <param name="u">A <see cref="Vector4D"/> instance.</param>
 /// <returns><see langword="true"/> if the two vectors are approximately equal; otherwise, <see langword="false"/>.</returns>
 public static bool ApproxEqual(Vector4D v, Vector4D u)
 {
     return(ApproxEqual(v, u, MathFunctions.EpsilonD));
 }
 /// <summary>
 /// Subtracts a vector from a second vector and puts the result into a third vector.
 /// </summary>
 /// <param name="u">A <see cref="Vector4D"/> instance.</param>
 /// <param name="v">A <see cref="Vector4D"/> instance</param>
 /// <param name="w">A <see cref="Vector4D"/> instance to hold the result.</param>
 /// <remarks>
 ///	w[i] = v[i] - w[i].
 /// </remarks>
 public static void Subtract(Vector4D u, Vector4D v, ref Vector4D w)
 {
     w.X = u.X - v.X;
     w.Y = u.Y - v.Y;
     w.Z = u.Z - v.Z;
     w.W = u.W - v.W;
 }
Exemple #38
0
 /// <summary>
 /// Adds two vectors.
 /// </summary>
 /// <param name="u">A <see cref="Vector4D"/> instance.</param>
 /// <param name="v">A <see cref="Vector4D"/> instance.</param>
 /// <returns>A new <see cref="Vector4D"/> instance containing the sum.</returns>
 public static Vector4D operator+(Vector4D u, Vector4D v)
 {
     return(Vector4D.Add(u, v));
 }
 /// <summary>
 /// Subtracts a vector from a scalar and put the result into another vector.
 /// </summary>
 /// <param name="u">A <see cref="Vector4D"/> instance.</param>
 /// <param name="s">A scalar.</param>
 /// <param name="v">A <see cref="Vector4D"/> instance to hold the result.</param>
 /// <remarks>
 /// v[i] = u[i] - s
 /// </remarks>
 public static void Subtract(Vector4D u, double s, ref Vector4D v)
 {
     v.X = u.X - s;
     v.Y = u.Y - s;
     v.Z = u.Z - s;
     v.W = u.W - s;
 }
Exemple #40
0
 /// <summary>
 /// Subtracts a vector from a vector.
 /// </summary>
 /// <param name="u">A <see cref="Vector4D"/> instance.</param>
 /// <param name="v">A <see cref="Vector4D"/> instance.</param>
 /// <returns>A new <see cref="Vector4D"/> instance containing the difference.</returns>
 /// <remarks>
 ///	result[i] = v[i] - w[i].
 /// </remarks>
 public static Vector4D operator-(Vector4D u, Vector4D v)
 {
     return(Vector4D.Subtract(u, v));
 }
 /// <summary>
 /// Subtracts a scalar from a vector and put the result into another vector.
 /// </summary>
 /// <param name="u">A <see cref="Vector4D"/> instance.</param>
 /// <param name="s">A scalar.</param>
 /// <param name="v">A <see cref="Vector4D"/> instance to hold the result.</param>
 /// <remarks>
 /// v[i] = s - u[i]
 /// </remarks>
 public static void Subtract(double s, Vector4D u, ref Vector4D v)
 {
     v.X = s - u.X;
     v.Y = s - u.Y;
     v.Z = s - u.Z;
     v.W = s - u.W;
 }
Exemple #42
0
 /// <summary>
 /// Subtracts a vector from a scalar.
 /// </summary>
 /// <param name="v">A <see cref="Vector4D"/> instance.</param>
 /// <param name="s">A scalar.</param>
 /// <returns>A new <see cref="Vector4D"/> instance containing the difference.</returns>
 /// <remarks>
 /// result[i] = s - v[i]
 /// </remarks>
 public static Vector4D operator-(double s, Vector4D v)
 {
     return(Vector4D.Subtract(s, v));
 }
 public override int VectorTakerPtr4(ref Vector4D pVec)
 {
     return base.VectorTakerPtr4(ref pVec);
 }
Exemple #44
0
 /// <summary>
 /// Divides a vector by a scalar.
 /// </summary>
 /// <param name="v">A <see cref="Vector4D"/> instance.</param>
 /// <param name="s">A scalar</param>
 /// <returns>A new <see cref="Vector4D"/> containing the quotient.</returns>
 /// <remarks>
 /// result[i] = v[i] / s;
 /// </remarks>
 public static Vector4D operator/(Vector4D v, double s)
 {
     return(Vector4D.Divide(v, s));
 }
 public override int VectorTakerRef4(ref Vector4D rVec)
 {
     rVec.W = 666;
     return 333;
 }
 public override int VectorTakerVal4(Vector4D vec)
 {
     return base.VectorTakerVal4(vec);
 }
        static void Main(string[] args)
        {
            Child child = Factory.GimmeAChild();
            Parent parent = Factory.GimmeAParent();
            Parent parent2 = Factory.GimmeAChildAsAParent();

            child.DoEvenMore();
            child.DoSomething(3, 4);
            parent.DoSomething(2, 3);
            parent2.DoSomething(1, 2);
            Child child2 = (Child)parent2;

            // SIZE howbig = SIZE.MEDIUM;
            // parent2.MethodWithRefSize(ref howbig);
            Vector3D v3 = new Vector3D(11, 22, 33);
            Vector4D v4 = new Vector4D(1, 2, 3, 4);
            Matrix4D mtx = new Matrix4D(11, 12, 13, 14, 21, 22, 23, 24, 31, 32, 33, 34, 41, 42, 43, 44);
            int res;

            // Handmade Matrix and Vector wrapping test
            // Note: This tests the mapping of C++ Matrix and Vector types
            // to exsiting C# Matrix and Vector types (and not wrapper classes)
            res = HandmadeWrappers.HandMadeVectorTaker(ref v4);
            //res = HandmadeWrappers.HandMadeMatrixTakerWrapper(ref mtx);
            Vector4D vRes = HandmadeWrappers.HandMadeVectorReturner();
            //Matrix4D mRes = HandmadeWrappers.HandMadeMatrixReturnerWrapper();
            Vector4D vRes2 = HandmadeWrappers.HandMadeVectorPtrReturnerWrapper();

            // Swig generated Matrix and Vector wrapping test
            // Note: This tests the mapping of C++ Matrix and Vector types
            // to exsiting C# Matrix and Vector types (and not wrapper classes generated by Swig).
            // The mapping of the types is done by Swig, though
            VectorConsumer vc = new VectorConsumer();
            //Matrix4D mRes2 = vc.GimmeSomeMatrix();

            res = vc.VectorTakerPtr3(ref v3);
            res = vc.VectorTakerRef3(ref v3);
            res = vc.VectorTakerVal3(v3);
            Vector3D vRet = vc.GimmeSomeVector();
            Vector3D vOld = vc.VV;
            vc.VV = vRet;
            vOld = vc.VV;

            res = vc.VectorTakerPtr4(ref v4);
            res = vc.VectorTakerRef4(ref v4);
            res = vc.VectorTakerVal4(v4);
            //res = vc.MatrixTakerPtr(ref mtx);
            //res = vc.MatrixTakerRef(ref mtx);
            //res = vc.MatrixTakerVal(mtx);

            MyVectorConsumer myVc = new MyVectorConsumer();
            VectorConsumerCaller.CallVectorConsumer(myVc);

            AParamType param = null;
            RefRefTest.ParameterTaker(ref param);
            int i = 8;
        }
Exemple #48
0
		/// <summary>
		/// Transforms a given vector by a matrix.
		/// </summary>
		/// <param name="matrix">A <see cref="Matrix4D"/> instance.</param>
		/// <param name="vector">A <see cref="Vector4D"/> instance.</param>
		/// <returns>A new <see cref="Vector4D"/> instance containing the result.</returns>
		public static Vector4D Transform(Matrix4D matrix, Vector4D vector)
		{
			return new Vector4D(
				(matrix.M11 * vector.X) + (matrix.M12 * vector.Y) + (matrix.M13 * vector.Z) + (matrix.M14 * vector.W),
				(matrix.M21 * vector.X) + (matrix.M22 * vector.Y) + (matrix.M23 * vector.Z) + (matrix.M24 * vector.W),
				(matrix.M31 * vector.X) + (matrix.M32 * vector.Y) + (matrix.M33 * vector.Z) + (matrix.M34 * vector.W),
				(matrix.M41 * vector.X) + (matrix.M42 * vector.Y) + (matrix.M43 * vector.Z) + (matrix.M44 * vector.W));
		}
Exemple #49
0
 /// <summary>
 /// Adds two vectors.
 /// </summary>
 /// <param name="v">A <see cref="Vector4D"/> instance.</param>
 /// <param name="w">A <see cref="Vector4D"/> instance.</param>
 /// <returns>A new <see cref="Vector4D"/> instance containing the sum.</returns>
 public static Vector4D Add(Vector4D v, Vector4D w)
 {
     return(new Vector4D(v.X + w.X, v.Y + w.Y, v.Z + w.Z, v.W + w.W));
 }
Exemple #50
0
		/// <summary>
		/// Initializes a new instance of the <see cref="Matrix4D"/> structure with the specified values.
		/// </summary>
		/// <param name="column1">A <see cref="Vector2D"/> instance holding values for the first column.</param>
		/// <param name="column2">A <see cref="Vector2D"/> instance holding values for the second column.</param>
		/// <param name="column3">A <see cref="Vector2D"/> instance holding values for the third column.</param>
		/// <param name="column4">A <see cref="Vector2D"/> instance holding values for the fourth column.</param>
		public Matrix4D(Vector4D column1, Vector4D column2, Vector4D column3, Vector4D column4)
		{
			_m11 = column1.X; _m12 = column2.X; _m13 = column3.X; _m14 = column4.X;
			_m21 = column1.Y; _m22 = column2.Y; _m23 = column3.Y; _m24 = column4.Y;
			_m31 = column1.Z; _m32 = column2.Z; _m33 = column3.Z; _m34 = column4.Z;
			_m41 = column1.W; _m42 = column2.W; _m43 = column3.W; _m44 = column4.W;
		}
 /// <summary>
 /// Adds a vector and a scalar.
 /// </summary>
 /// <param name="v">A <see cref="Vector4D"/> instance.</param>
 /// <param name="s">A scalar.</param>
 /// <returns>A new <see cref="Vector4D"/> instance containing the sum.</returns>
 public static Vector4D Add(Vector4D v, double s)
 {
     return new Vector4D(v.X + s, v.Y + s, v.Z + s, v.W +s);
 }