public Vetor3D produtoVetorial(Vetor3D v) { Vetor3D vr = new Vetor3D(); vr.setX(y * v.getZ() - z * v.getY()); vr.setY(z * v.getX() - x * v.getZ()); vr.setZ(x * v.getY() - y * v.getX()); return(vr); }
private void button2_Click(object sender, EventArgs e) { rtbPV.Clear(); Vetor3D vr; Vetor3D v1 = new Vetor3D(Convert.ToDouble(textBox4.Text), Convert.ToDouble(textBox5.Text), Convert.ToDouble(textBox6.Text)); Vetor3D v2 = new Vetor3D(Convert.ToDouble(textBox9.Text), Convert.ToDouble(textBox8.Text), Convert.ToDouble(textBox7.Text)); vr = v1.produtoVetorial(v2); rtbPV.AppendText("O vetor resultado é: (" + vr.getX() + "," + vr.getY() + "," + vr.getZ() + ")"); }
private void button1_Click(object sender, EventArgs e) { rtbMV.Clear(); if (textBox3.Text == "") { Vetor2D v = new Vetor2D(Convert.ToDouble(textBox1.Text), Convert.ToDouble(textBox2.Text)); rtbMV.AppendText("O módulo vetorial é:" + Math.Round(v.moduloVetorial(), 3)); } else { Vetor3D v = new Vetor3D(Convert.ToDouble(textBox1.Text), Convert.ToDouble(textBox2.Text), Convert.ToDouble(textBox3.Text)); rtbMV.AppendText("O módulo vetorial é:" + Math.Round(v.moduloVetorial3D(), 3)); } }