Exemple #1
0
 private void CalculateAngleAppro()
 {
     for (int i = 0; i < net.angleNum; i++)
     {
         int parent = net.netAngles[i].parent;
         int me     = net.netAngles[i].me;
         int child  = net.netAngles[i].child;
         //mp + theta = mc
         double angle_mp = NetPoint.Azimuth
                               (net.netPoints[me], net.netPoints[parent]);
         double angle_mc = NetPoint.Azimuth
                               (net.netPoints[me], net.netPoints[child]);
         double theta = angle_mc - angle_mp;
         theta = IMathNet.Adjust_0To2PI(theta);
         net.netAngles[i].value = theta;
         observeAppro.value[i + net.lengthNum, 0] = theta;
     }
 }
Exemple #2
0
        private void WriteAnglesAdjust()
        {
            StreamWriter streamWriter = new StreamWriter(pathAnglesAdjust);
            int          i;

            for (i = 0; i < net.angleNum; i++)
            {
                int      AIndex = i + net.lengthNum;
                double[] deg    = IMathNet.ToDeg(observeAdjust.value[AIndex, 0]);
                streamWriter.WriteLine("{0},{1},{2},{3},{4},{5:f1}"
                                       , net.netAngles[i].parent
                                       , net.netAngles[i].me
                                       , net.netAngles[i].child
                                       , deg[0]   //度
                                       , deg[1]   //分
                                       , deg[2]); //秒
            }

            streamWriter.Close();
        }
Exemple #3
0
        public double CalculateAngleClosure(List <int> circle)
        {
            double angleClosure = 0;
            int    Vnum         = circle.Count - 1;//起始点到起始点,多一个
            int    parent       = circle[Vnum - 1];
            int    me           = circle[0];
            int    child        = circle[1];

            int  angleOrder = -1;    //设置-1,以检查错误
            bool isleft = false;
            int  i, j;

            double val;

            //寻找角度序号,判断左右角
            for (i = 0; i < net.angleNum; i++)
            {
                if (net.netAngles[i].me == me)
                {
                    if (net.netAngles[i].parent == parent && net.netAngles[i].child == child)
                    {
                        isleft     = true;
                        angleOrder = i;
                        break;
                    }
                    if (net.netAngles[i].parent == child && net.netAngles[i].child == parent)
                    {
                        isleft     = false;
                        angleOrder = i;
                        break;
                    }
                }
            }
            angleOrder += net.lengthNum;

            if (isleft)
            {
                val = IMathNet.Adjust_0To2PI(observeAdjust.value[angleOrder, 0]);
            }
            else
            {
                val = IMathNet.Adjust_0To2PI(-observeAdjust.value[angleOrder, 0]);
            }
            angleClosure += val;

            for (j = 0; j < Vnum - 1; j++)//有几个点就有几个角
            {
                parent = me;
                me     = child;
                child  = circle[j + 2];
                for (i = 0; i < net.angleNum; i++)
                {
                    if (net.netAngles[i].me == me)
                    {
                        if (net.netAngles[i].parent == parent && net.netAngles[i].child == child)
                        {
                            isleft     = true;
                            angleOrder = i;
                            break;
                        }
                        if (net.netAngles[i].parent == child && net.netAngles[i].child == parent)
                        {
                            isleft     = false;
                            angleOrder = i;
                            break;
                        }
                    }
                }
                angleOrder += net.lengthNum;


                if (isleft)
                {
                    val = IMathNet.Adjust_0To2PI(observeAdjust.value[angleOrder, 0]);
                }
                else
                {
                    val = IMathNet.Adjust_0To2PI(-observeAdjust.value[angleOrder, 0]);
                }
                angleClosure += val;
            }

            double res       = 0;
            double inAngles  = (Vnum - 2) * PI;
            double outAngles = 2 * PI * Vnum - inAngles;

            res = angleClosure - inAngles;
            bool isIn = -PI / 6 < res && res < PI / 6;

            if (!isIn)
            {
                res = angleClosure - outAngles;
            }

            res = res / PI * 180 * 3600;


            return(res);
        }