コード例 #1
0
        /// <summary>
        /// 给定起始和结束数组索引,获取字符串数组中从开始索引到结束索引下的所有点。test success
        /// </summary>
        /// <param name="x_sIdentifier1"></param>
        /// <param name="x_sIdentifier2"></param>
        /// <param name="x_sTargetString"></param>
        /// <param name="x_nStartIndex"></param>
        /// <param name="x_nEndIndex"></param>
        /// <param name="x_ListPoint"></param>
        /// <returns></returns>
        public bool getPoint(string x_sIdentifier1, char x_sIdentifier2, string[] x_sTargetString, int x_nStartIndex, int x_nEndIndex, out List <DataType.StaubliRobotData.St_PointRx> x_ListPoint)
        {
            bool l_bResult = false;

            x_ListPoint = null;
            List <DataType.StaubliRobotData.St_PointRx> l_arrayList = new List <DataType.StaubliRobotData.St_PointRx>();

            DataType.StaubliRobotData.St_PointRx l_pPoint = new DataType.StaubliRobotData.St_PointRx();
            for (int i = x_nStartIndex + 1; i <= x_nEndIndex - 1; i++)
            {
                l_bResult = getPoint(x_sIdentifier1, x_sIdentifier2, x_sTargetString[i], ref l_pPoint);
                if (l_bResult == true)
                {
                    l_arrayList.Add(l_pPoint);
                }
            }
            if (l_arrayList.Count == 0)
            {
                l_bResult = false;
            }
            else
            {
                x_ListPoint = l_arrayList; l_bResult = true;
            }
            return(l_bResult);
        }
コード例 #2
0
        //<summary>
        //判断三点共线(第三点到直线的距离作为精度【相关技术要求】)
        //</summary>
        //<returns>true:共线</returns>false:不共线
        public static bool CKYThreeColline(DataType.StaubliRobotData.St_PointRx x_pPoint1, DataType.StaubliRobotData.St_PointRx x_pPoint2, DataType.StaubliRobotData.St_PointRx x_pPoint3, double x_nDistancePrecision, ref double x_nActualError)
        {
            bool l_bResult = false;

            DataType.BasicDataType.vector l_V1, l_V2, l_V3;
            l_V1 = Point2Vector(x_pPoint1);
            l_V2 = Point2Vector(x_pPoint2);
            l_V3 = Point2Vector(x_pPoint3);
            double l_nDistance1 = BasicMathTool.VectorDistance(l_V1, l_V2);
            double l_nDistance2 = BasicMathTool.VectorDistance(l_V1, l_V3);

            if (l_nDistance1 <= l_nDistance2)
            {
                double l_nDiastance = PointToLineDistance(l_V1, l_V2, l_V3);
                if (l_nDiastance <= x_nDistancePrecision)
                {
                    l_bResult = true; x_nActualError = l_nDiastance;
                }
                else
                {
                    l_bResult = false;
                }
            }
            else
            {
                l_bResult = false;
            }
            return(l_bResult);
        }
コード例 #3
0
 public static DataType.BasicDataType.vector Point2Vector(DataType.StaubliRobotData.St_PointRx x_pPoint)
 {
     DataType.BasicDataType.vector l_v;
     l_v.x = x_pPoint.x;
     l_v.y = x_pPoint.y;
     l_v.z = x_pPoint.z;
     return(l_v);
 }
コード例 #4
0
        /// <summary>
        /// 转换为离线文件标准字符串形式
        /// </summary>
        /// <returns></returns>
        public string Trans2Standard(DataType.StaubliRobotData.St_JointRx x_jJoint, DataType.StaubliRobotData.St_PointRx x_pPoint, string x_sPropertySeparator, string x_sPointSeparator, string x_sMoveType)
        {
            string l_sString = string.Empty;
            string l_sJoint  = Joint2String(x_jJoint, x_sPointSeparator);
            string l_sPoint  = Point2String(x_pPoint, x_sPointSeparator);

            l_sString = x_sMoveType + x_sPropertySeparator + l_sJoint + x_sPropertySeparator + l_sPoint + x_sPropertySeparator;
            return(l_sString);
        }
コード例 #5
0
        public static bool VectAngle(DataType.StaubliRobotData.St_PointRx x_pPoint1, DataType.StaubliRobotData.St_PointRx x_pPoint2, DataType.StaubliRobotData.St_PointRx x_pPoint3, ref double x_nAngle)
        {
            BasicDataType.vector l_v1, l_v2, l_v3;
            l_v1 = PointTool.Point2Vector(x_pPoint1);
            l_v2 = PointTool.Point2Vector(x_pPoint2);
            l_v3 = PointTool.Point2Vector(x_pPoint3);
            bool l_bResult = VectAngle(l_v1, l_v2, l_v3, ref x_nAngle);

            return(l_bResult);
        }
コード例 #6
0
        public static bool ThreeColline(DataType.StaubliRobotData.St_PointRx x_pPoint1, DataType.StaubliRobotData.St_PointRx x_pPoint2, DataType.StaubliRobotData.St_PointRx x_pPoint3, double x_nPrecision)
        {
            bool l_bResult = false;

            DataType.BasicDataType.vector l_V1, l_V2, l_V3;
            l_V1      = Point2Vector(x_pPoint1);
            l_V2      = Point2Vector(x_pPoint2);
            l_V3      = Point2Vector(x_pPoint3);
            l_bResult = ThreeColline(l_V1, l_V2, l_V3, x_nPrecision);
            return(l_bResult);
        }
コード例 #7
0
        /// <summary>
        ///  判断点是否在圆上
        /// </summary>
        /// <returns></returns>
        public static bool CKYIsOnCircle(DataType.StaubliRobotData.St_PointRx x_pPoint1, DataType.StaubliRobotData.St_PointRx x_pPoint2, DataType.StaubliRobotData.St_PointRx x_pPoint3, DataType.StaubliRobotData.St_PointRx x_pPoint4, double x_nLinePrecision, double x_nCirclePrecision, ref double x_nActualError)
        {
            bool l_bResult = false;

            DataType.BasicDataType.vector l_v1, l_v2, l_v3, l_v4;
            l_v1      = Point2Vector(x_pPoint1);
            l_v2      = Point2Vector(x_pPoint2);
            l_v3      = Point2Vector(x_pPoint3);
            l_v4      = Point2Vector(x_pPoint4);
            l_bResult = CKYIsOnCircle(l_v1, l_v2, l_v3, l_v4, x_nLinePrecision, x_nCirclePrecision, ref x_nActualError);
            return(l_bResult);
        }
コード例 #8
0
        public string Point2String(DataType.StaubliRobotData.St_PointRx x_pPoint, string x_sSeparator)
        {
            string l_sString = string.Empty;

            double[] l_nNum    = new double[6];
            bool     l_bResult = Point2Double(ref l_nNum, x_pPoint);

            if (l_bResult == true)
            {
                l_sString = Double2String(l_nNum, x_sSeparator);
            }
            return(l_sString);
        }
コード例 #9
0
        public bool Point2Double(ref double[] x_nNumber, DataType.StaubliRobotData.St_PointRx x_pPoint)
        {
            bool l_bOk = false;

            if (x_nNumber.Length != 6)
            {
                l_bOk = false;
            }
            else
            {
                x_nNumber[0] = x_pPoint.x;
                x_nNumber[1] = x_pPoint.y;
                x_nNumber[2] = x_pPoint.z;
                x_nNumber[3] = x_pPoint.Rx;
                x_nNumber[4] = x_pPoint.Ry;
                x_nNumber[5] = x_pPoint.Rz;
                l_bOk        = true;
            }
            return(l_bOk);
        }
コード例 #10
0
        /// <summary>
        /// 字符串数组转换为点类型 test success
        /// </summary>
        /// <param name="x_sPoint"></param>
        /// <param name="x_pPoint"></param>
        /// <returns></returns>
        public bool String2Point(string[] x_sPoint, ref DataType.StaubliRobotData.St_PointRx x_pPoint)
        {
            bool l_bOk = false;

            if (x_sPoint.Length != 6)
            {
                l_bOk = false;
            }
            else
            {
                x_pPoint.x  = double.Parse(x_sPoint[0]);
                x_pPoint.y  = double.Parse(x_sPoint[1]);
                x_pPoint.z  = double.Parse(x_sPoint[2]);
                x_pPoint.Rx = double.Parse(x_sPoint[3]);
                x_pPoint.Ry = double.Parse(x_sPoint[4]);
                x_pPoint.Rz = double.Parse(x_sPoint[5]);
                l_bOk       = true;
            }
            return(l_bOk);
        }
コード例 #11
0
        /// <summary>
        /// 获取点信息 test success
        /// </summary>
        /// <param name="x_sIdentifier1"></param>
        /// <param name="x_sIdentifier2"></param>
        /// <param name="x_sTargetString"></param>
        /// <param name="x_pPoint"></param>
        /// <returns></returns>
        public bool getPoint(string x_sIdentifier1, char x_sIdentifier2, string x_sTargetString, ref DataType.StaubliRobotData.St_PointRx x_pPoint)
        {
            bool       l_bOk       = false;
            List <int> l_nPosition = new List <int>();

            l_bOk = FindString(x_sIdentifier1, x_sTargetString, ref l_nPosition);
            if (l_bOk == true)
            {
                try
                {
                    string   l_sString = x_sTargetString.Substring(l_nPosition[1] + 1, l_nPosition[2] - l_nPosition[1] - 1);
                    string[] l_sPoint  = l_sString.Split(x_sIdentifier2);
                    l_bOk = String2Point(l_sPoint, ref x_pPoint);
                }
                catch (Exception ex)
                {
                    throw new Exception("Error:getPoint exception: " + ex.Message);
                }
            }
            return(l_bOk);
        }