Exemplo n.º 1
0
        private void aSTLMeasuringTool_ZAngle_OnFinish(object sender, EventArgs e)
        {
            STLMeasuringTool_ZAngle STLMeasuringTool_ZAngle = sender as STLMeasuringTool_ZAngle;

            if (STLMeasuringTool_ZAngle.TouchPoints[0] != null && STLMeasuringTool_ZAngle.TouchPoints[1] != null)
            {
                PointD measurePoint, touchPoint;
                //讀取第一個PitchPoint的旋轉角
                measurePoint = this.PitchPoint1;
                touchPoint   = STLMeasuringTool_ZAngle.TouchPoints[0];
                touchPoint.OpenGLDisplaySize = 0.001;
                RotateAngles.Add(measurePoint, Atan2(touchPoint.Y, touchPoint.X) - Atan2(measurePoint.Y, measurePoint.X));
                RotateDistance.Add(measurePoint, Norm(measurePoint - new PointD(0, 0, measurePoint.Z)) * RotateAngles[measurePoint]);
                RotatedPitchPoint.Add(measurePoint, STLMeasuringTool_ZAngle.TouchPoints[0]);
                //讀取第二個PitchPoint的旋轉角
                measurePoint = this.PitchPoint2;
                touchPoint   = STLMeasuringTool_ZAngle.TouchPoints[1];
                touchPoint.OpenGLDisplaySize = 0.001;
                RotateAngles.Add(measurePoint, Atan2(touchPoint.Y, touchPoint.X) - Atan2(measurePoint.Y, measurePoint.X));
                RotateDistance.Add(measurePoint, Norm(measurePoint - new PointD(0, 0, measurePoint.Z)) * RotateAngles[measurePoint]);
                RotatedPitchPoint.Add(measurePoint, STLMeasuringTool_ZAngle.TouchPoints[1]);

                //根據旋轉兩個旋轉角旋轉拓樸面
                double rotateAngle;
                rotateAngle       = RotateAngles[this.PitchPoint1];
                TopoFace1.Points  = TransformPoints(RotateMatrix(Axis.Z, rotateAngle), TopoFace1.Points);
                TopoFace1.Normals = TransformPoints(RotateMatrix(Axis.Z, rotateAngle), TopoFace1.Normals);
                rotateAngle       = RotateAngles[this.PitchPoint2];
                TopoFace2.Points  = TransformPoints(RotateMatrix(Axis.Z, rotateAngle), TopoFace2.Points);
                TopoFace2.Normals = TransformPoints(RotateMatrix(Axis.Z, rotateAngle), TopoFace2.Normals);
                Solve();
            }
        }
 public LoadingUC_ViewModel()
 {
     RT = new System.Timers.Timer(100);
     for (int i = 0; i < 8; i++)
     {
         RotateAngles.Add(i * 40);
         DirectionAngles.Add(i * 40 + 315);
     }
     RT.Elapsed += RT_Elapsed;
     RT.Start();
 }