//时间: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) { } } }