Exemple #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();
        }
Exemple #2
0
        public static void drawGL_FrameData_Triangle(SharpGL.OpenGL gl_object, ModelBuilder builder, int jumpFrame)
        {
            if (builder._ShowPoints == null || builder._ShowPoints.Length <= 0)
            {
                return;
            }

            gl_object.Clear(OpenGL.COLOR_BUFFER_BIT | OpenGL.DEPTH_BUFFER_BIT);

            //可以不用每次都旋轉,可以滑鼠動作時變更即可
            //不影響效能
            gl_object.LoadIdentity();
            gl_object.Translate(GLDrawObject._LX, GLDrawObject._LY, GLDrawObject._LZ);
            gl_object.Rotate(GLDrawObject._RoX, 0.0, 1.0, 0.0);
            gl_object.Rotate(GLDrawObject._RoY, 1.0, 0.0, 0.0);
            gl_object.Rotate(GLDrawObject._RoZ, 0.0, 0.0, 1.0);

            for (int j = 0; j < builder._LJV7Frame.LJVcount - jumpFrame; j += jumpFrame)
            {
                gl_object.Begin(OpenGL.TRIANGLE_STRIP);
                for (int i = 0; i < builder._LJV7Frame.size_per_frame - jumpFrame; i += jumpFrame)
                {
                    int pos = Convert.ToInt32(i * builder._LJV7Frame.LJVcount + j);
                    if (builder._ShowPoints[pos].Z == -999 || builder._ShowPoints[pos + jumpFrame].Z == -999)
                    {
                        gl_object.End();
                        gl_object.Begin(OpenGL.TRIANGLE_STRIP);
                        continue;
                    }

                    DPoint point = builder._ShowPoints[pos];
                    gl_object.Color(point.r, point.g, point.b);
                    gl_object.Vertex(point.X, point.Y, point.Z);

                    point = builder._ShowPoints[pos + jumpFrame];
                    gl_object.Color(point.r, point.g, point.b);
                    gl_object.Vertex(point.X, point.Y, point.Z);

                    //Console.WriteLine("X:" + point.r);
                    //Console.WriteLine("Y:" + point.g);
                    //Console.WriteLine("Z:" + point.b);
                }
                gl_object.End();
            }

            GLDrawObject.drawAxis(gl_object);
            gl_object.Flush();
            return;
        }
Exemple #3
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;
                }
            }
        }
Exemple #4
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);
        }