コード例 #1
0
        public void reBuild_Excel(double range_max, double range_min)
        {
            //double diff = _LJV7Frame.Max_Buffer_Compute - _LJV7Frame.Min_Buffer_Compute;

            double diff = 3.35440063;

            //double diff = _LJV7Frame.Max_Buffer_Compute - _LJV7Frame.Min_Buffer_Compute;
            if (range_max > 0 && range_min > 0)
            {
                diff = range_max - range_min;
            }
            else
            {
                range_max = _LJV7Frame.Max_Buffer_Compute;
                range_min = _LJV7Frame.Min_Buffer_Compute;
                diff      = _LJV7Frame.Max_Buffer_Compute - _LJV7Frame.Min_Buffer_Compute;
            }

            //TsPointS startp = StartPoint;
            for (int i = 0, k = 0; i < _LJV7Frame.size_per_frame; i++, k++)
            {
                //TsPointS point = _PointList[i / _EACHSIZE];
                //Console.WriteLine("Angle=" + (startp.C + diffAngle * k));
                //double arc = DPoint.Angle2Arc(startp.C + ((point.C - startp.C) / _EACHSIZE) * k);

                for (int j = 0; j < _LJV7Frame.LJVcount; j++)
                {
                    int pos = Convert.ToInt32(i * _LJV7Frame.LJVcount + j);

                    //_ShowPoints[pos].C = arc;

                    if (_LJV7Frame.buffer_compute[pos] == -999 || _LJV7Frame.buffer_compute[pos] < range_min || _LJV7Frame.buffer_compute[pos] > range_max)
                    {
                        _ShowPoints[pos].X = _ShowPoints[pos].Y = _ShowPoints[pos].Z = -999;
                        continue;
                    }


                    double Color_H = (_LJV7Frame.buffer_compute[pos] - range_min) / diff;
                    Color_H = Color_H * (GLDrawObject.MaxColorH - GLDrawObject.MinColorH) + GLDrawObject.MinColorH;
                    GLDrawObject.HsvToRgb(Color_H, 1.0, 1.0, out _ShowPoints[pos].r, out _ShowPoints[pos].g, out _ShowPoints[pos].b);

                    _ShowPoints[pos].X = (Convert.ToDouble(i)) / Convert.ToDouble(250);
                    _ShowPoints[pos].Z = (_LJV7Frame.buffer_compute[pos]) - 55; // Convert.ToDouble(10);

                    /*_ShowPoints[pos].X = (Normalization(_LJV7Frame.buffer_compute[pos])) * Math.Cos(arc);
                    *  _ShowPoints[pos].Z = (Normalization(_LJV7Frame.buffer_compute[pos])) * Math.Sin(arc);*/
                    _ShowPoints[pos].Y = ((_LJV7Frame.LJVcount / 2.0 - Convert.ToDouble(j)) / Convert.ToDouble(100));
                }
            }

            //SaveComputeDataToCSV();
        }
コード例 #2
0
        public void reBuild_MoveLser(double range_max, double range_min)
        {
            if (_LJV7Frame.buffer == null || _LJV7Frame.buffer_compute == null || _ShowPoints == null)
            {
                return;
            }
            Console.WriteLine("build: r=" + _Radio + ", angle=" + StartPoint.C + ", center=(" + center.X + ", " + center.Y + ")");

            double Y_Conversion = Distance_Conversion(Y_Distance);

            double diff = _LJV7Frame.Max_Buffer_Compute - _LJV7Frame.Min_Buffer_Compute;

            if (range_max > 0 && range_min > 0)
            {
                diff = range_max - range_min;
            }
            else
            {
                range_max = _LJV7Frame.Max_Buffer_Compute;
                range_min = _LJV7Frame.Min_Buffer_Compute;
            }

            TsPointS startp    = StartPoint;
            TsPointS diffPoint = new TsPointS();

            for (int i = 0, k = 0; i < _LJV7Frame.size_per_frame; i++, k++)
            {
                TsPointS point = _PointList[i / _EACHSIZE];
                diffPoint.X = startp.X + (point.X - startp.X) * k / _EACHSIZE;
                diffPoint.Y = startp.Y + (point.Y - startp.Y) * k / _EACHSIZE;
                diffPoint.C = DPoint.Angle2Arc(startp.C + ((point.C - startp.C) / _EACHSIZE) * k);

                double arc = DPoint.Angle2Arc(startp.C + ((point.C - startp.C) / _EACHSIZE) * k);
                for (int j = 0; j < _LJV7Frame.LJVcount; j++)
                {
                    int pos = Convert.ToInt32(i * _LJV7Frame.LJVcount + j);
                    _ShowPoints[pos].C = diffPoint.C;

                    if (_LJV7Frame.buffer_compute[pos] == -999 || _LJV7Frame.buffer_compute[pos] < range_min || _LJV7Frame.buffer_compute[pos] > range_max)
                    {
                        _ShowPoints[pos].X = _ShowPoints[pos].Y = _ShowPoints[pos].Z = -999;
                        continue;
                    }

                    double Color_H = (_LJV7Frame.buffer_compute[pos] - range_min) / diff;
                    Color_H = Color_H * (GLDrawObject.MaxColorH - GLDrawObject.MinColorH) + GLDrawObject.MinColorH;
                    GLDrawObject.HsvToRgb(Color_H, 1.0, 1.0, out _ShowPoints[pos].r, out _ShowPoints[pos].g, out _ShowPoints[pos].b);

                    //對應到新座標: 拉平座標(實際接收資料)
                    //_ShowPoints[pos].X = (Convert.ToDouble(i)) / Convert.ToDouble(100);
                    //_ShowPoints[pos].Z = _Radio - _LJV7Frame.buffer_compute[pos];+

                    /*
                     * //原本程式
                     * _ShowPoints[pos].X = (_Radio - _LJV7Frame.buffer_compute[pos]) * Math.Cos(diffPoint.C);
                     * _ShowPoints[pos].Z = (_Radio - _LJV7Frame.buffer_compute[pos]) * Math.Sin(diffPoint.C);
                     */

                    //對應到新座標: 對應回現實座標

                    /*
                     * _ShowPoints[pos].X = diffPoint.X - _LJV7Frame.buffer_compute[pos] * Math.Cos(diffPoint.C) - center.X;
                     * _ShowPoints[pos].Z = diffPoint.Y - _LJV7Frame.buffer_compute[pos] * Math.Sin(diffPoint.C) - center.Y;
                     * _ShowPoints[pos].Y = ((_LJV7Frame.LJVcount / 2.0 - Convert.ToDouble(j)) / Convert.ToDouble(70)) + 2;
                     */


                    _ShowPoints[pos].X = (Normalization(_LJV7Frame.buffer_compute[pos])) * Math.Cos(arc);
                    _ShowPoints[pos].Z = (Normalization(_LJV7Frame.buffer_compute[pos])) * Math.Sin(arc);
                    _ShowPoints[pos].Y = ((_LJV7Frame.LJVcount / Y_Conversion - Convert.ToDouble(j)) / Convert.ToDouble(100));

                    /*_ShowPoints[pos].X = (Normalization(_LJV7Frame.buffer_compute[pos])) * Math.Cos(diffPoint.C);
                     * _ShowPoints[pos].Z = (Normalization(_LJV7Frame.buffer_compute[pos])) * Math.Sin(diffPoint.C);
                     * _ShowPoints[pos].Y = ((_LJV7Frame.LJVcount / Y_Conversion - Convert.ToDouble(j)) / Convert.ToDouble(100)) + 2;*/
                    //_ShowPoints[pos].Y = ((_LJV7Frame.LJVcount / 2.0 - Convert.ToDouble(j)) / Convert.ToDouble(70)) + 2;
                }
                if (k == 99)
                {
                    k      = -1;
                    startp = point;
                }
            }
        }
コード例 #3
0
        public void reBuild_MoveObject(double range_max, double range_min)
        {
            if (_LJV7Frame.buffer == null || _LJV7Frame.buffer_compute == null || _ShowPoints == null)
            {
                return;
            }

            Console.WriteLine("build: r=" + _Radio + ", angle=" + StartPoint.C + ", center=(" + center.X + ", " + center.Y + ")");

            double Y_Conversion = Distance_Conversion(Y_Distance);

            double diff = _LJV7Frame.Max_Buffer_Compute - _LJV7Frame.Min_Buffer_Compute;

            if (range_max > 0 && range_min > 0)
            {
                diff = range_max - range_min;
            }
            else
            {
                range_max = _LJV7Frame.Max_Buffer_Compute;
                range_min = _LJV7Frame.Min_Buffer_Compute;
            }
            double   min_distance = 9999;
            TsPointS startp       = StartPoint;

            for (int i = 0, k = 0; i < _LJV7Frame.size_per_frame; i++, k++)
            {
                TsPointS point = _PointList[i / _EACHSIZE];
                //Console.WriteLine("Angle=" + (startp.C + diffAngle * k));
                double arc = DPoint.Angle2Arc(startp.C + ((point.C - startp.C) / _EACHSIZE) * k);

                /*if (arc > 0)
                 * {
                 *  arc = arc;
                 *  ;
                 * }*/
                for (int j = 0; j < _LJV7Frame.LJVcount; j++)
                {
                    int pos = Convert.ToInt32(i * _LJV7Frame.LJVcount + j);
                    _ShowPoints[pos].C = arc;

                    if (_LJV7Frame.buffer_compute[pos] == -999 || _LJV7Frame.buffer_compute[pos] < range_min || _LJV7Frame.buffer_compute[pos] > range_max)
                    {
                        _ShowPoints[pos].X = _ShowPoints[pos].Y = _ShowPoints[pos].Z = -999;
                        continue;
                    }

                    double Color_H = (_LJV7Frame.buffer_compute[pos] - range_min) / diff;
                    Color_H = Color_H * (GLDrawObject.MaxColorH - GLDrawObject.MinColorH) + GLDrawObject.MinColorH;
                    GLDrawObject.HsvToRgb(Color_H, 1.0, 1.0, out _ShowPoints[pos].r, out _ShowPoints[pos].g, out _ShowPoints[pos].b);

                    //對應到新座標: 拉平座標(實際接收資料)
                    //_ShowPoints[pos].X = (Convert.ToDouble(i)) / Convert.ToDouble(100);
                    //_ShowPoints[pos].Z = _Radio - fr_LJV7Frameame.buffer_compute[pos];
                    if (_LJV7Frame.buffer_compute[pos] < min_distance)
                    {
                        min_distance = _LJV7Frame.buffer_compute[pos];
                    }

                    //對應到新座標: 對應回現實座標
                    //*
                    //_ShowPoints[pos].X = _Radio * Math.Cos(arc);
                    //_ShowPoints[pos].X *= (_Radio - _LJV7Frame.buffer_compute[pos]) / _Radio;
                    //_ShowPoints[pos].Z = _Radio * Math.Sin(arc);
                    //_ShowPoints[pos].Z *= (_Radio - _LJV7Frame.buffer_compute[pos]) / _Radio;

                    /*
                     * //原本程式
                     * _ShowPoints[pos].X = (_Radio - _LJV7Frame.buffer_compute[pos]) * Math.Cos(diffPoint.C);
                     * _ShowPoints[pos].Z = (_Radio - _LJV7Frame.buffer_compute[pos]) * Math.Sin(diffPoint.C);
                     * _ShowPoints[pos].Y = ((_LJV7Frame.LJVcount / 2.0 - Convert.ToDouble(j)) / Convert.ToDouble(70)) + 2;
                     */

                    _ShowPoints[pos].X = (Normalization(_LJV7Frame.buffer_compute[pos])) * Math.Cos(arc);
                    _ShowPoints[pos].Z = (Normalization(_LJV7Frame.buffer_compute[pos])) * Math.Sin(arc);
                    _ShowPoints[pos].Y = ((_LJV7Frame.LJVcount / Y_Conversion - Convert.ToDouble(j)) / Convert.ToDouble(100));
                    //_ShowPoints[pos].Y = ((_LJV7Frame.LJVcount / 2.0 - Convert.ToDouble(j)) / Convert.ToDouble(70)) + 2;



                    /*_ShowPoints[pos].X = (i/15);
                     * _ShowPoints[pos].Z = (double)(j-288)/25;
                     * _ShowPoints[pos].Y = (_LJV7Frame.buffer_compute[pos] - _LJV7Frame.Min_Buffer_Compute)*8;*/
                }
                if (k == 99)
                {
                    k      = -1;
                    startp = point;
                }
            }
            //Console.WriteLine("Max Distance = " + min_distance);
        }