示例#1
0
        public void RenderGeometry()
        {
            if (this.axisStart != null && axisEnd != null && this.radius != 0 && this.sliceNumber != 0)
            {
                this.face = new TopoFace()
                {
                    Points = new PointD[2, sliceNumber], Normals = new Vector[2, sliceNumber]
                };

                Vector axisDirection = AxisEnd - AxisStart;
                Vector N1            = Cross(new Vector(0, 0, 1), axisDirection);
                if (Norm(N1) == 0)
                {
                    N1 = Cross(new Vector(0, 1, 0), axisDirection);
                }
                N1 = Normalize(N1);

                double dTheta = PI * 2.0 / (sliceNumber - 1);
                double[,] M = IdentityMatrix(4);

                for (int i = 0; i < sliceNumber; i++)
                {
                    M = RotateMatrix(axisDirection, dTheta * i);
                    Vector n = RotatePoint(M, N1);
                    Vector r = n * this.Radius;

                    this.face.Normals[0, i] = n;
                    this.face.Normals[1, i] = n;
                    this.face.Points[0, i]  = AxisStart + r;
                    this.face.Points[1, i]  = AxisEnd + r;
                }
            }
        }
示例#2
0
        public override object Clone()
        {
            TopoFace newTopoFace = new TopoFace()
            {
                Color = this._color, SurfaceDisplayOption = this.SurfaceDisplayOption
            };

            if (this.CoordinateSystem != null)
            {
                newTopoFace.CoordinateSystem = this.CoordinateSystem;
            }
            if (this.Points != null)
            {
                newTopoFace.Points = new PointD[this.Points.GetLength(0), this.Points.GetLength(1)];
                for (int i = 0; i < this.Points.GetLength(0); i++)
                {
                    for (int j = 0; j < this.Points.GetLength(1); j++)
                    {
                        if (this.Points[i, j] != null)
                        {
                            newTopoFace.Points[i, j] = this.Points[i, j].Clone() as PointD;
                        }
                    }
                }
            }
            if (this.Normals != null)
            {
                newTopoFace.Normals = new Vector[this.Normals.GetLength(0), this.Normals.GetLength(1)];
                for (int i = 0; i < this.Normals.GetLength(0); i++)
                {
                    for (int j = 0; j < this.Normals.GetLength(1); j++)
                    {
                        if (this.Normals[i, j] != null)
                        {
                            newTopoFace.Normals[i, j] = this.Normals[i, j].Clone() as Vector;
                        }
                    }
                }
            }
            return(newTopoFace);
        }
示例#3
0
 /// <summary>
 /// 模擬P40量測類別的建構式
 /// </summary>
 /// <param name="STL2Measure">欲量測的STL</param>
 /// <param name="TopoFace1">第一拓樸面</param>
 /// <param name="TopoFace2">第二拓樸面</param>
 /// <param name="PitchPoint1">第一拓樸面的PitchPoint</param>
 /// <param name="PitchPoint2">第二拓樸面的PitchPoint</param>
 /// <param name="ThreadNumber">執行緒數目</param>
 /// <param name="OnFinish">計算完成時的後續動作</param>
 public STLMeasuringTool_P40_SingleTooth(STL STL2Measure, TopoFace TopoFace1, TopoFace TopoFace2, PointD PitchPoint1, PointD PitchPoint2, int ThreadNumber, EventHandler OnFinish)
 {
     this.STL2Measure = STL2Measure;
     this.TopoFace1 = TopoFace1;
     this.TopoFace2 = TopoFace2;
     this.PitchPoint1 = PitchPoint1;
     this.PitchPoint2 = PitchPoint2;
     this.ThreadNumber = ThreadNumber;
     this.OnFinish += OnFinish;
 }
示例#4
0
 public override object Clone()
 {
     TopoFace newTopoFace = new TopoFace() { Color = this._color, SurfaceDisplayOption = this.SurfaceDisplayOption };
     if (this.CoordinateSystem != null)
         newTopoFace.CoordinateSystem = this.CoordinateSystem;
     if (this.Points != null)
     {
         newTopoFace.Points = new PointD[this.Points.GetLength(0), this.Points.GetLength(1)];
         for (int i = 0; i < this.Points.GetLength(0); i++)
         {
             for (int j = 0; j < this.Points.GetLength(1); j++)
             {
                 if (this.Points[i, j] != null)
                     newTopoFace.Points[i, j] = this.Points[i, j].Clone() as PointD;
             }
         }
     }
     if (this.Normals != null)
     {
         newTopoFace.Normals = new Vector[this.Normals.GetLength(0), this.Normals.GetLength(1)];
         for (int i = 0; i < this.Normals.GetLength(0); i++)
         {
             for (int j = 0; j < this.Normals.GetLength(1); j++)
             {
                 if (this.Normals[i, j] != null)
                     newTopoFace.Normals[i, j] = this.Normals[i, j].Clone() as Vector;
             }
         }
     }
     return newTopoFace;
 }
示例#5
0
        public void RenderGeometry()
        {
            if (this.axisStart != null && axisEnd != null && this.radius != 0 && this.sliceNumber != 0)
            {
                this.face = new TopoFace() { Points = new PointD[2, sliceNumber], Normals = new Vector[2, sliceNumber]};

                Vector axisDirection = AxisEnd - AxisStart;
                Vector N1 = Cross(new Vector(0, 0, 1), axisDirection);
                if (Norm(N1) == 0)
                    N1 = Cross(new Vector(0, 1, 0), axisDirection);
                N1 = Normalize(N1);

                double dTheta = PI * 2.0 / (sliceNumber - 1);
                double[,] M = IdentityMatrix(4);

                for (int i = 0; i < sliceNumber; i++)
                {
                    M = RotateMatrix(axisDirection, dTheta * i);
                    Vector n = RotatePoint(M, N1);
                    Vector r = n * this.Radius;

                    this.face.Normals[0, i] = n;
                    this.face.Normals[1, i] = n;
                    this.face.Points[0, i] = AxisStart + r;
                    this.face.Points[1, i] = AxisEnd + r;
                }
            }
        }