예제 #1
0
파일: Vetor3D.cs 프로젝트: Scdk/OOP
        public Vetor3D multiplicaVetor(Vetor3D r2)
        {
            Vetor3D r3 = new Vetor3D();

            r3.setX((y * r2.getZ()) - (r2.getY() * z));
            r3.setY((r2.getX() * z) - (x * r2.getZ()));
            r3.setZ((x * r2.getY()) - (r2.getX() * y));
            return(r3);
        }
예제 #2
0
        static void Main(string[] args)
        {
            Vetor3D a = new Vetor3D();
            Vetor3D b = new Vetor3D();
            Vetor3D c = new Vetor3D();

            Console.WriteLine("Digite a componente x do vetor B:");
            b.setX(Convert.ToDouble(Console.ReadLine()));
            Console.WriteLine("Digite a componente y do vetor B:");
            b.setY(Convert.ToDouble(Console.ReadLine()));
            Console.WriteLine("Digite a componente z do vetor B:");
            b.setZ(Convert.ToDouble(Console.ReadLine()));

            Console.WriteLine("Modulo do vetor a: " + a.Modulo3D());
            Console.WriteLine("Modulo do vetor b: " + b.Modulo3D());
            c = a.Vetorial(b);
            Console.WriteLine("O produto vetorial de a e b é: (" + c.getX() + ", " + c.getY() + ", " + c.getZ() + ")");
            Console.ReadLine();
        }