gesphere.h 3.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. //////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright 2015 Autodesk, Inc. All rights reserved.
  4. //
  5. // Use of this software is subject to the terms of the Autodesk license
  6. // agreement provided at the time of installation or download, or which
  7. // otherwise accompanies this software in either electronic or hard copy form.
  8. //
  9. //////////////////////////////////////////////////////////////////////////////
  10. //
  11. // Description:
  12. //
  13. // This file implements the class AcGeSphere, a representation for a
  14. // sphere. It is defined by its radius, and the center. Two vectors,
  15. // northAxis and refAxis are used in the parameterization of
  16. // the sphere. northAxis identifies the north and the south poles
  17. // of the sphere. refAxis serves as a reference for the parameters.
  18. // It is a vector orthogonal to northAxis.
  19. // Parameter u is the longitude, which for a closed sphere defaults
  20. // to the range [-PI, PI). Zero corresponds to the meridian that
  21. // contains the refAxis of the sphere.
  22. // Parameter v is the latitude, which for a closed sphere defaults
  23. // to the range [-PI/2, PI/2]. The lower bound maps to the south
  24. // pole, zero is on the equator, and the upperbound maps to the north
  25. // pole.
  26. // The sphere is periodic in u with a period of 2PI.
  27. // [umin, umax] x [vmin, vmax] defines a four sided spherical patch
  28. // bounded by two arcs that are meridians of longitude, and two arcs
  29. // that are parallels of latitude. Following constraints apply when
  30. // defining a spherical patch.
  31. // umin < umax and |umin - umax| <= 2PI.
  32. // vmin < vmax and |vmin - vmax| <= PI.
  33. //
  34. #ifndef AC_GESPHERE_H
  35. #define AC_GESPHERE_H
  36. #include "gegbl.h"
  37. #include "gepnt3d.h"
  38. #include "gevec3d.h"
  39. #include "geintrvl.h"
  40. #include "gesurf.h"
  41. #pragma pack (push, 8)
  42. class AcGeCircArc3d;
  43. class
  44. GX_DLLEXPIMPORT
  45. AcGeSphere : public AcGeSurface
  46. {
  47. public:
  48. AcGeSphere();
  49. AcGeSphere(double radius, const AcGePoint3d& center);
  50. AcGeSphere(double radius, const AcGePoint3d& center,
  51. const AcGeVector3d& northAxis, const AcGeVector3d& refAxis,
  52. double startAngleU, double endAngleU,
  53. double startAngleV, double endAngleV);
  54. AcGeSphere(const AcGeSphere& sphere);
  55. // Geometric properties.
  56. //
  57. double radius () const;
  58. AcGePoint3d center () const;
  59. void getAnglesInU (double& start, double& end) const;
  60. void getAnglesInV (double& start, double& end) const;
  61. AcGeVector3d northAxis () const;
  62. AcGeVector3d refAxis () const;
  63. AcGePoint3d northPole () const;
  64. AcGePoint3d southPole () const;
  65. Adesk::Boolean isOuterNormal () const;
  66. Adesk::Boolean isClosed (const AcGeTol& tol = AcGeContext::gTol) const;
  67. AcGeSphere& setRadius (double);
  68. AcGeSphere& setAnglesInU (double start, double end);
  69. AcGeSphere& setAnglesInV (double start, double end);
  70. AcGeSphere& set (double radius, const AcGePoint3d& center);
  71. AcGeSphere& set (double radius, const AcGePoint3d& center,
  72. const AcGeVector3d& northAxis,
  73. const AcGeVector3d& refAxis,
  74. double startAngleU,
  75. double endAngleU,
  76. double startAngleV,
  77. double endAngleV);
  78. // Assignment operator.
  79. //
  80. AcGeSphere& operator = (const AcGeSphere& sphere);
  81. // Intersection with a linear entity
  82. //
  83. Adesk::Boolean intersectWith (const AcGeLinearEnt3d&, int& intn,
  84. AcGePoint3d& p1, AcGePoint3d& p2,
  85. const AcGeTol& tol = AcGeContext::gTol) const;
  86. };
  87. #pragma pack (pop)
  88. #endif