Beispiel #1
0
 public override void GetSlopeAndDia(Vector3d vec, out double[] slope, out double[] dia)
 {
     slope = new double[2];
     dia   = new double[2];
     double[] rid;
     FaceUtils.GetSweptSlope(this.Data.Face, vec, out slope, out rid);
     dia[0] = 2 * rid[0];
     dia[1] = 2 * rid[1];
 }
Beispiel #2
0
 /// <summary>
 /// 分析面
 /// </summary>
 /// <param name="vec"></param>
 public void AnalyzeFace(Vector3d vec)
 {
     this.FaceData   = FaceUtils.AskFaceData(this.face);
     this.ResultsNum = TraceARay.AskTraceARayForFaceData(face, vec);
     this.Vec        = vec;
     if (this.face.SolidFaceType == Face.FaceType.Planar) //平面
     {
         this.MaxRadius = 0;
         this.MinRadius = 0;
         double angle = Math.Round(UMathUtils.Angle(vec, this.FaceData.Dir), 3);
         this.MaxSlope = angle;
         this.MinSlope = angle;
         return;
     }
     if (this.face.SolidFaceType == Face.FaceType.Cylindrical)
     {
         this.MaxRadius = Math.Round(this.FaceData.Radius, 3) * this.FaceData.IntNorm;
         this.MinRadius = Math.Round(this.FaceData.Radius, 3) * this.FaceData.IntNorm;
         AskFace(vec);
         return;
     }
     if (this.face.SolidFaceType == Face.FaceType.Conical)
     {
         this.MaxRadius = Math.Round(this.FaceData.Radius, 3) * this.FaceData.IntNorm;
         this.MinRadius = Math.Round(this.FaceData.RadData, 3) * this.FaceData.IntNorm;
         AskFace(vec);
         return;
     }
     else
     {
         double[] slope;
         double[] rad;
         FaceUtils.GetSweptSlope(this.face, vec, out slope, out rad);
         foreach (double temp in slope)
         {
             if (this.MaxSlope > temp)
             {
                 this.MaxSlope = Math.Round(temp, 3);
             }
             if (this.MinSlope < temp)
             {
                 this.MinSlope = Math.Round(temp, 3);
             }
         }
         foreach (double temp in rad)
         {
             if (this.MaxRadius > temp)
             {
                 this.MaxRadius = Math.Round(temp, 3);
             }
             if (this.MinRadius < temp)
             {
                 this.MinRadius = Math.Round(temp, 3);
             }
         }
     }
 }
Beispiel #3
0
        public override void GetSlopeAndDia(Vector3d vec, out double[] slope, out double[] dia)
        {
            slope = new double[2];
            dia   = new double[2];
            double anlge = UMathUtils.Angle(vec, Data.Dir);

            dia[0] = dia[1] = 2 * Data.Radius;
            if (UMathUtils.IsEqual(anlge, 0) || UMathUtils.IsEqual(anlge, Math.PI))
            {
                slope[0] = slope[1] = Math.PI / 2;
            }
            else
            {
                double[] rid;
                FaceUtils.GetSweptSlope(this.Data.Face, vec, out slope, out rid);
            }
        }
        public override void GetSlopeAndDia(Vector3d vec, out double[] slope, out double[] dia)
        {
            slope = new double[2] {
                99999, -99999
            };
            dia = new double[2] {
                99999, -99999
            };
            double anlge = UMathUtils.Angle(vec, Data.Dir);

            if (UMathUtils.IsEqual(anlge, 0) || UMathUtils.IsEqual(anlge, Math.PI))
            {
                slope[0] = slope[1] = UMathUtils.Angle(vec, FaceUtils.AskFaceNormal(this.Data.Face));
                foreach (Edge edge in this.Data.Face.GetEdges())
                {
                    if (edge.SolidEdgeType == Edge.EdgeType.Circular)
                    {
                        double radius = EdgeUtils.GetArcRadius(edge);

                        if (2 * radius > dia[1])
                        {
                            dia[1] = 2 * radius;
                        }
                        if (2 * radius < dia[0])
                        {
                            dia[0] = 2 * radius;
                        }
                    }
                }
                if (dia[0] == 99999)
                {
                    dia[0] = 0;
                }
            }
            else
            {
                double[] rid;
                FaceUtils.GetSweptSlope(this.Data.Face, vec, out slope, out rid);
                dia[0] = 2 * rid[0];
                dia[1] = 2 * rid[1];
            }
        }