Cross() public static méthode

Perform the cross product on two vectors.
public static Cross ( Vec3 a, Vec3 b ) : Vec3
a Vec3
b Vec3
Résultat Vec3
Exemple #1
0
        public Vec3 Solve33(Vec3 b)
        {
            float num = Vec3.Dot(this.Col1, Vec3.Cross(this.Col2, this.Col3));

            Box2DXDebug.Assert(num != 0f);
            num = 1f / num;
            return(new Vec3
            {
                X = num * Vec3.Dot(b, Vec3.Cross(this.Col2, this.Col3)),
                Y = num * Vec3.Dot(this.Col1, Vec3.Cross(b, this.Col3)),
                Z = num * Vec3.Dot(this.Col1, Vec3.Cross(this.Col2, b))
            });
        }
Exemple #2
0
        /// <summary>
        /// Solve A * x = b, where b is a column vector. This is more efficient
        /// than computing the inverse in one-shot cases.
        /// </summary>
        public Vec3 Solve33(Vec3 b)
        {
            float det = Vec3.Dot(Col1, Vec3.Cross(Col2, Col3));

            Box2DXDebug.Assert(det != 0.0f);
            det = 1.0f / det;
            Vec3 x = new Vec3();

            x.X = det * Vec3.Dot(b, Vec3.Cross(Col2, Col3));
            x.Y = det * Vec3.Dot(Col1, Vec3.Cross(b, Col3));
            x.Z = det * Vec3.Dot(Col1, Vec3.Cross(Col2, b));
            return(x);
        }