空间直角坐标系的旋转转换

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

空间直角坐标系的旋转转换usingSystem;usingSystem.Collections.Generic;usingSystem.ComponentModel;usingSystem.Data;usingSystem.Drawing;usingSystem.Linq;usingSystem.Text;usingSystem.IO;usingSystem.Windows.Forms;namespaceReferenceTransition{publicpartialclassForm1:Form{publicForm1(){this.MaximizeBox=false;InitializeComponent();}privatedoublex,y,z;privatedoublei,j,k;privatedoublea1,a2,a3;privatedoubleb1,b2,b3;privatedoublec1,c2,c3;privatedoublerx,ry,rz;privatestringt1,t2,t3;privatestringk1,k2,k3;privatevoidbutton1_Click(objectsender,EventArgse){textBox1.Text=;textBox2.Text=;textBox3.Text=;textBox4.Text=;textBox5.Text=;textBox6.Text=;textBox7.Text=;textBox8.Text=;textBox9.Text=;richTextBox1.Text=;}privatevoidbutton4_Click(objectsender,EventArgse){try{try{t1=textBox1.Text.ToString();t2=textBox2.Text.ToString();t3=textBox3.Text.ToString();k1=textBox4.Text.ToString();k2=textBox5.Text.ToString();k3=textBox6.Text.ToString();}catch(Exceptioneee){MessageBox.Show(文本框中格式输入不正确!请检查确认!!);}x=double.Parse(t1);y=double.Parse(t2);z=double.Parse(t3);i=double.Parse(k1);j=double.Parse(k2);k=double.Parse(k3);a1=Math.Cos(i)*Math.Cos(k)-Math.Sin(i)*Math.Sin(j)*Math.Sin(k);a2=-Math.Cos(i)*Math.Sin(k)-Math.Sin(i)*Math.Sin(j)*Math.Cos(k);a3=-Math.Sin(i)*Math.Cos(j);b1=Math.Cos(j)*Math.Sin(k);b2=Math.Cos(j)*Math.Cos(k);b3=-Math.Sin(j);c1=Math.Sin(i)*Math.Cos(k)+Math.Cos(i)*Math.Sin(j)*Math.Sin(k);c2=-Math.Sin(i)*Math.Sin(k)+Math.Cos(i)*Math.Sin(j)*Math.Cos(k);c3=Math.Cos(i)*Math.Cos(j);rx=a1*x+a2*y-a3*z;ry=b1*x+b2*y-b3*x;rz=c1*x+c2*y-c3*z;textBox7.Text=rx.ToString();textBox8.Text=ry.ToString();textBox9.Text=rz.ToString();richTextBox1.AppendText(转换前坐标:x=+textBox1.Text+y=+textBox2.Text+f=+textBox3.Text+\r);richTextBox1.AppendText(旋转角度:ψ=+textBox4.Text+ω=+textBox5.Text+κ=+textBox6.Text+\r);richTextBox1.AppendText(转换后坐标为:X=+textBox7.Text+Y=+textBox8.Text+Z=+textBox9.Text+\r);}catch(Exceptioneee){MessageBox.Show(输入的数字有误,无法计算结果,请核查!!);}}privatevoidbutton3_Click(objectsender,EventArgse){this.Close();}privatevoidbutton2_Click(objectsender,EventArgse){StreamWritersw=null;saveFileDialog1.Filter=文本文件(*.txt)|*.txt|Word文档(*.doc)|*.doc;if(saveFileDialog1.ShowDialog()==DialogResult.OK){try{sw=newStreamWriter(saveFileDialog1.FileName,false,System.Text.Encoding.Unicode);sw.Write(richTextBox1.Text);}catch(Exceptioneee){MessageBox.Show(保存失败!!);}finally{if(sw!=null){sw.Close();}}}}}}

1 / 3
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功