コード例 #1
0
ファイル: Vector.cs プロジェクト: ronnotel/Orbitsphere
        public Vector CrossProduct(Vector vector)
        {
            Vector newVector = new Vector();
            newVector.SetXYZ(Y * vector.Z - Z * vector.Y,
                Z * vector.X - X * vector.Z,
                X * vector.Y - Y * vector.X);

            return newVector;
        }
コード例 #2
0
ファイル: Vector.cs プロジェクト: ronnotel/Orbitsphere
        public Vector PlanarRotation(double angle)
        {
            Vector rotatedVector = new Vector();
            double rotMatrix11 = Math.Cos(angle);
            double rotMatrix12 = -Math.Sin(angle);
            double rotMatrix21 = Math.Sin(angle);
            double rotMatrix22 = Math.Cos(angle);
            rotatedVector.SetXYZ(X * rotMatrix11 + Y * rotMatrix12,
                X * rotMatrix21 + Y * rotMatrix22,
                0);

            return rotatedVector;
        }
コード例 #3
0
ファイル: Vector.cs プロジェクト: ronnotel/Orbitsphere
 public Vector ScalarProduct(double scalar)
 {
     Vector newVector = new Vector();
     newVector.SetXYZ(X * scalar, Y * scalar, Z * scalar);
     return newVector;
 }
コード例 #4
0
ファイル: Vector.cs プロジェクト: ronnotel/Orbitsphere
 public static Vector operator +(Vector aVector, Vector addend)
 {
     Vector newVector = new Vector();
     newVector.SetXYZ(aVector.X + addend.X, aVector.Y + addend.Y, aVector.Z + addend.Z);
     return newVector;
 }