SemPosition.cs 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. //时间:20200610
  2. //作者:郝爽
  3. //功能:六孔坐标位置
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. namespace MeasureData
  10. {
  11. //六轴坐标系统
  12. public class SemPosition
  13. {
  14. private float m_x, m_y, m_z, m_r, m_t, m_m;
  15. #region X
  16. //限定范围
  17. const float Xmax = 100;
  18. const float Xmin = 10;
  19. public float X
  20. {
  21. get { return this.m_x; }
  22. set => this.m_x = rangeCheckedX(value);
  23. }
  24. private static float rangeCheckedX(float x)
  25. {
  26. if (x > Xmax) x = Xmax;
  27. else if (x < Xmin) x = Xmin;
  28. return x;
  29. }
  30. #endregion
  31. #region Y
  32. //限定范围
  33. const float Ymax = 100;
  34. const float Ymin = 10;
  35. public float Y
  36. {
  37. get { return this.m_y; }
  38. set => this.m_y = rangeCheckedY(value);
  39. }
  40. private static float rangeCheckedY(float y)
  41. {
  42. if (y > Ymax) y = Ymax;
  43. else if (y < Ymin) y = Ymin;
  44. return y;
  45. }
  46. #endregion
  47. #region Z
  48. //限定范围
  49. const float Zmax = 100;
  50. const float Zmin = 10;
  51. public float Z
  52. {
  53. get { return this.m_z; }
  54. set => this.m_z = rangeCheckedZ(value);
  55. }
  56. private static float rangeCheckedZ(float z)
  57. {
  58. if (z > Zmax) z = Zmax;
  59. else if (z < Zmin) z = Zmin;
  60. return z;
  61. }
  62. #endregion
  63. #region R
  64. //限定范围
  65. const float Rmax = 100;
  66. const float Rmin = 10;
  67. public float R
  68. {
  69. get { return this.m_r; }
  70. set => this.m_r = rangeCheckedR(value);
  71. }
  72. private static float rangeCheckedR(float r)
  73. {
  74. if (r > Rmax) r = Rmax;
  75. else if (r < Rmin) r = Rmin;
  76. return r;
  77. }
  78. #endregion
  79. #region T
  80. //限定范围
  81. const float Tmax = 100;
  82. const float Tmin = 10;
  83. public float T
  84. {
  85. get { return this.m_t; }
  86. set => this.m_t = rangeCheckedT(value);
  87. }
  88. private static float rangeCheckedT(float t)
  89. {
  90. if (t > Tmax) t = Tmax;
  91. else if (t < Tmin) t = Tmin;
  92. return t;
  93. }
  94. #endregion
  95. #region M
  96. //限定范围
  97. const float Mmax = 100;
  98. const float Mmin = 10;
  99. public float M
  100. {
  101. get { return this.m_m; }
  102. set => this.m_m = rangeCheckedM(value);
  103. }
  104. private static float rangeCheckedM(float m)
  105. {
  106. if (m > Mmax) m = Mmax;
  107. else if (m < Mmin) m = Mmin;
  108. return m;
  109. }
  110. #endregion
  111. public SemPosition()
  112. {
  113. m_x = 0;
  114. m_y = 0;
  115. m_z = 0;
  116. m_r = 0;
  117. m_t = 0;
  118. m_m = 0;
  119. }
  120. //从文件中加载位置信息
  121. public void GetPtsFromFile(string fileName)
  122. {
  123. }
  124. }
  125. }