getol.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. //
  2. //////////////////////////////////////////////////////////////////////////////
  3. //
  4. // Copyright 2015 Autodesk, Inc. All rights reserved.
  5. //
  6. // Use of this software is subject to the terms of the Autodesk license
  7. // agreement provided at the time of installation or download, or which
  8. // otherwise accompanies this software in either electronic or hard copy form.
  9. //
  10. //////////////////////////////////////////////////////////////////////////////
  11. //
  12. // DESCRIPTION:
  13. //
  14. // This file contains the functionality for managing tolerances within
  15. // gelib.
  16. //
  17. // This is an instantiable class that is initialized to the default
  18. // tolerances. Subsequently, the tolerances within it can be customized
  19. // to suite a specific need. For example, an instance of this class
  20. // may be specialized to be utilized during surface intersection.
  21. //
  22. // DESCRIPTION
  23. //
  24. // 1. Two points p1 and p2 are equal if and only if
  25. //
  26. // (p1 - p2).length() <= equalPoint
  27. //
  28. // 2. Two vectors v1 and v2 are equal if and only if
  29. //
  30. // (v1 - v2).length() <= equalVector
  31. //
  32. // 3. Two vectors v1 and v2 are parallel if and only if
  33. //
  34. // ( v1/v1.length() - v2/v2.length() ).length() < equalVector
  35. // OR ( v1/v1.length() + v2/v2.length() ).length() < equalVector
  36. //
  37. // 4. Two vectors v1 and v2 are perpendicular if and only if
  38. //
  39. // abs((v1.dotProduct(v2))/(v1.length()*v2.length())) <= equalVector
  40. //
  41. // 5. Two lines or rays are parallel (perpendicular) if and only if
  42. // their directional vectors are parallel (perpendicular)
  43. //
  44. // 6. Two lines are equal if and only if they have points within equalPoint
  45. // and they are parallel.
  46. //
  47. // IMPORTANT: These rules mean that two lines are close to each other as
  48. // point sets in the part of the modeling space of diameter
  49. // DIAM, if only the tolerance equalVector is set tighter than
  50. // equalPoint/DIAM
  51. #ifndef AC_GETOL_H
  52. #define AC_GETOL_H
  53. #ifndef unix
  54. #include <stdlib.h>
  55. #endif
  56. #include "gedll.h"
  57. #include "gedblar.h"
  58. #pragma pack (push, 8)
  59. class
  60. GE_DLLEXPIMPORT
  61. AcGeTol {
  62. public:
  63. AcGeTol();
  64. // Inquiry functions.
  65. //
  66. double equalPoint () const;
  67. double equalVector () const;
  68. // Set functions.
  69. //
  70. void setEqualPoint ( double val );
  71. void setEqualVector ( double val );
  72. private:
  73. double mTolArr[5];
  74. int mAbs;
  75. friend class AcGeTolA;
  76. };
  77. // Inlines for AcGeTol
  78. //
  79. inline void AcGeTol::setEqualVector( double val )
  80. { mTolArr[1] = val; }
  81. inline double AcGeTol::equalVector() const
  82. { return mTolArr[1]; }
  83. inline void AcGeTol::setEqualPoint( double val )
  84. { mTolArr[0] = val; }
  85. inline double AcGeTol::equalPoint() const
  86. { return mTolArr[0]; }
  87. #pragma pack (pop)
  88. #endif