Beispiel #1
0
        /*     e)     */

        public double Angulo_Dois_Vetores(Vetor2D vetor)
        {
            double cos;

            cos = (Produto_Escalar(vetor) / (Modulo_do_Vetor() * vetor.Modulo_do_Vetor()));
            return(Math.Acos(cos) * 180 / Math.PI);
        }
Beispiel #2
0
        /*     f)     */

        public Vetor2D Vetor_Projecao(Vetor2D vetor)
        {
            double  proj;
            Vetor2D vetorprojecao = new Vetor2D();

            proj = (Produto_Escalar(vetor) / Produto_Escalar(this));
            vetorprojecao.Setx(Getx() * proj);
            vetorprojecao.Sety(Gety() * proj);
            return(vetorprojecao);
        }
Beispiel #3
0
        static void Main(string[] args)
        {
            Vetor2D VetorA = new Vetor2D(3.0, 7.0);
            Vetor2D VetorB = new Vetor2D(2.0, 4.0);

            Console.WriteLine("Produto Escalar: " + VetorA.Produto_Escalar(VetorB));
            Console.WriteLine("Modulo do VetorA: " + VetorA.Modulo_do_Vetor());
            Console.WriteLine("Modulo do VetorB: " + VetorB.Modulo_do_Vetor());
            Console.WriteLine("Angulo Entre os Dois Vetores: " + VetorA.Angulo_Dois_Vetores(VetorB) + " graus");
            Vetor2D VetorProj = new Vetor2D();

            VetorProj = VetorA.Vetor_Projecao(VetorB);

            Console.WriteLine("Projeção do Vetor A no Vetor B: (" + VetorProj.Getx() + " , " + VetorProj.Gety() + ")");
            VetorProj = VetorB.Vetor_Projecao(VetorA);
            Console.WriteLine("Projeção do Vetor B no Vetor A: (" + VetorProj.Getx() + " , " + VetorProj.Gety() + ")");
            Console.ReadLine();
        }
Beispiel #4
0
        /*     c)     */

        public double Produto_Escalar(Vetor2D vetor)
        {
            return(x * vetor.Getx() + y * vetor.Gety());
        }