getorus.h 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  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 implements the class AcGeTorus, a reprsentation for a
  15. // torus. It is a surface generated by revolving a circular
  16. // arc about an axis of symmetry, where the plane of the arc is a plane
  17. // containing the axis of symmetry. The torus is located in space by its
  18. // origin which is a point on the axis of symetry. The locus of the
  19. // center of the circular arc is at a distance of majorRadius from
  20. // the origin of the torus. The radius of the circular arc is the
  21. // minorRadius.
  22. // Parameter u is the longitude, which for a closed torus defaults
  23. // to the range [-PI, PI). Zero corresponds to the refAxis (which is
  24. // a vector orthogonal to the axis of symetry). Applying the right
  25. // hand rule along the symetric axis defines the increasing direction
  26. // for u.
  27. // Parameter v parameterizes the circular arc (of revolution), which
  28. // for a closed circle defaults to the range [-PI, PI). Applying the
  29. // right hand rule along the refAxis X symetricAxis defines the
  30. // increasing direction for v.
  31. // The torus is periodic in u, v with a period of 2PI.
  32. // [umin, umax] x [vmin, vmax] defines a four sided toroidal patch bounded
  33. // by four circular arcs. Following constraints apply to the definition
  34. // of a toroidal patch.
  35. // umin < umax and |umin - umax| <= 2PI.
  36. // vmin < vmax and |vmin - vmax| <= 2PI
  37. //
  38. #ifndef AC_GETORUS_H
  39. #define AC_GETORUS_H
  40. #include "gegbl.h"
  41. #include "gesurf.h"
  42. #include "geintrvl.h"
  43. #include "gevec3d.h"
  44. #pragma pack (push, 8)
  45. class AcGeCircArc3d;
  46. class
  47. GX_DLLEXPIMPORT
  48. AcGeTorus : public AcGeSurface
  49. {
  50. public:
  51. AcGeTorus();
  52. AcGeTorus(double majorRadius, double minorRadius,
  53. const AcGePoint3d& origin, const AcGeVector3d& axisOfSymmetry);
  54. AcGeTorus(double majorRadius, double minorRadius,
  55. const AcGePoint3d& origin, const AcGeVector3d& axisOfSymmetry,
  56. const AcGeVector3d& refAxis,
  57. double startAngleU, double endAngleU,
  58. double startAngleV, double endAngleV);
  59. AcGeTorus(const AcGeTorus& torus);
  60. // Geometric properties.
  61. //
  62. double majorRadius () const;
  63. double minorRadius () const;
  64. void getAnglesInU (double& start, double& end) const;
  65. void getAnglesInV (double& start, double& end) const;
  66. AcGePoint3d center () const;
  67. AcGeVector3d axisOfSymmetry () const;
  68. AcGeVector3d refAxis () const;
  69. Adesk::Boolean isOuterNormal () const;
  70. AcGeTorus& setMajorRadius (double radius);
  71. AcGeTorus& setMinorRadius (double radius);
  72. AcGeTorus& setAnglesInU (double start, double end);
  73. AcGeTorus& setAnglesInV (double start, double end);
  74. AcGeTorus& set (double majorRadius, double minorRadius,
  75. const AcGePoint3d& origin,
  76. const AcGeVector3d& axisOfSymmetry);
  77. AcGeTorus& set (double majorRadius, double minorRadius,
  78. const AcGePoint3d& origin,
  79. const AcGeVector3d& axisOfSymmetry,
  80. const AcGeVector3d& refAxis,
  81. double startAngleU, double endAngleU,
  82. double startAngleV, double endAngleV);
  83. // Assignment operator.
  84. //
  85. AcGeTorus& operator = (const AcGeTorus& torus);
  86. // Intersection with a linear entity
  87. //
  88. Adesk::Boolean intersectWith (const AcGeLinearEnt3d& linEnt, int& intn,
  89. AcGePoint3d& p1, AcGePoint3d& p2,
  90. AcGePoint3d& p3, AcGePoint3d& p4,
  91. const AcGeTol& tol = AcGeContext::gTol) const;
  92. // The following methods classify the shape according to the
  93. // relationship between the major and minor radii of the torus.
  94. // Exactly one of the first four functions should return TRUE
  95. // for any given torus.
  96. //
  97. Adesk::Boolean isLemon () const;
  98. Adesk::Boolean isApple () const;
  99. Adesk::Boolean isVortex () const;
  100. Adesk::Boolean isDoughnut () const;
  101. Adesk::Boolean isDegenerate() const;
  102. Adesk::Boolean isHollow () const;
  103. };
  104. #pragma pack (pop)
  105. #endif