| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155 | //时间:20200610//作者:郝爽//功能:六孔坐标位置using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;namespace MeasureData{    //六轴坐标系统    public class SemPosition    {        private float m_x, m_y, m_z, m_r, m_t, m_m;        #region X        //限定范围        const float Xmax = 100;        const float Xmin = 10;        public float X        {            get { return this.m_x; }            set => this.m_x = rangeCheckedX(value);        }        private static float rangeCheckedX(float x)        {            if (x > Xmax) x = Xmax;            else if (x < Xmin) x = Xmin;            return x;        }        #endregion        #region Y        //限定范围        const float Ymax = 100;        const float Ymin = 10;        public float Y        {            get { return this.m_y; }            set => this.m_y = rangeCheckedY(value);        }        private static float rangeCheckedY(float y)        {            if (y > Ymax) y = Ymax;            else if (y < Ymin) y = Ymin;            return y;        }        #endregion        #region Z        //限定范围        const float Zmax = 100;        const float Zmin = 10;        public float Z        {            get { return this.m_z; }            set => this.m_z = rangeCheckedZ(value);        }        private static float rangeCheckedZ(float z)        {            if (z > Zmax) z = Zmax;            else if (z < Zmin) z = Zmin;            return z;        }        #endregion        #region R        //限定范围        const float Rmax = 100;        const float Rmin = 10;        public float R        {            get { return this.m_r; }            set => this.m_r = rangeCheckedR(value);        }        private static float rangeCheckedR(float r)        {            if (r > Rmax) r = Rmax;            else if (r < Rmin) r = Rmin;            return r;        }        #endregion        #region T        //限定范围        const float Tmax = 100;        const float Tmin = 10;        public float T        {            get { return this.m_t; }            set => this.m_t = rangeCheckedT(value);        }        private static float rangeCheckedT(float t)        {            if (t > Tmax) t = Tmax;            else if (t < Tmin) t = Tmin;            return t;        }        #endregion        #region M        //限定范围        const float Mmax = 100;        const float Mmin = 10;        public float M        {            get { return this.m_m; }            set => this.m_m = rangeCheckedM(value);        }        private static float rangeCheckedM(float m)        {            if (m > Mmax) m = Mmax;            else if (m < Mmin) m = Mmin;            return m;        }        #endregion        public SemPosition()        {            m_x = 0;            m_y = 0;            m_z = 0;            m_r = 0;            m_t = 0;            m_m = 0;        }        //从文件中加载位置信息        public void GetPtsFromFile(string fileName)        {        }    }}
 |