Esempio n. 1
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;
            }
        }
Esempio n. 2
0
        public static InspDataSet BuildDataAsync(CancellationToken ct, IProgress <int> progress, RasterInspScript script, double[] rawDataSet, DataOutputOptions options)
        {
            try
            {
                var sw = new Stopwatch();
                progress.Report(sw.Elapsed.Seconds);

                var dataSet = BuildRasterPoints(script, rawDataSet);

                return(dataSet);
            }
            catch (Exception)
            {
                throw;
            }
        }