Пример #1
0
 /// <summary>
 /// build axial data set from raw data
 /// </summary>
 /// <param name="script"></param>
 /// <param name="rawInputData"></param>
 static InspDataSet BuildAxialPoints(AxialInspScript script, double[] data)
 {
     try
     {
         var points = new CylData(script.InputDataFileName);
         var len    = data.Length;
         if (len == 0)
         {
             throw new Exception("Data file length cannot equal zero");
         }
         //script.AxialIncrement = Math.Abs((script.EndLocation.X - script.StartLocation.X) / len);
         if (script.AxialIncrement == 0)
         {
             throw new Exception("Axial increment cannot equal zero.");
         }
         var dataSet = new CylDataSet(script.InputDataFileName);
         for (int i = 0; i < len; i++)
         {
             var pt = GetDiamPoint(i, data[i], script);
             dataSet.CylData.Add(pt);
             dataSet.UncorrectedCylData.Add(pt);
         }
         dataSet.DataFormat = script.ScanFormat;
         return(dataSet);
     }
     catch (Exception)
     {
         throw;
     }
 }
Пример #2
0
        static InspDataSet BuildRasterPoints(RasterInspScript script, double[] data)
        {
            try
            {
                var    points    = new CylData(script.InputDataFileName);
                double theta     = script.StartLocation.Adeg;
                double z         = script.StartLocation.X;
                double r         = 0;
                double nextZ     = script.StartLocation.X + script.AxialIncrement;
                double direction = 1;
                var    dataSet   = new CylDataSet(script.InputDataFileName);
                for (int i = 0; i < data.Length; i++)
                {
                    theta = i * script.AngleIncrement + script.StartLocation.Adeg;;

                    if (theta >= script.EndLocation.Adeg && z < nextZ)
                    {
                        direction = -1;
                        z         = i * script.AxialIncrement + script.StartLocation.X;
                    }
                    if (theta <= script.EndLocation.Adeg && z < nextZ)
                    {
                        direction = 1;
                        z         = i * script.AxialIncrement + script.StartLocation.X;
                    }
                    if (theta < script.EndLocation.Adeg && theta > script.StartLocation.Adeg)
                    {
                        if (direction > 0)
                        {
                            theta = direction * i * script.AngleIncrement + script.StartLocation.Adeg;
                        }
                        if (direction < 0)
                        {
                            theta = direction * i * script.AngleIncrement + script.EndLocation.Adeg;
                        }
                        if (z >= nextZ)
                        {
                            nextZ += script.AxialIncrement;
                        }
                    }

                    r = data[i];
                    var pt = new PointCyl(r, GeomUtilities.ToRadians(theta), z, i);
                    dataSet.CylData.Add(pt);
                }
                return(dataSet);
            }
            catch (Exception)
            {
                throw;
            }
        }