gecone.h 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  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 AcGeCone, a representation for
  15. // a single right circular cone. It is defined by its axis of
  16. // symmetry, height, half angle (the angle between the generating
  17. // line and the axis of symmetry), its origin which is a point on
  18. // the axis of symmetry, and the radius at the origin. The cross
  19. // section containing the origin is refered to as the base. The
  20. // radius at the base should not be zero. The cone may extend on
  21. // either side of the base.
  22. // The fabs(halfAngle) is constrained to the interval (0, PI/2),
  23. // and is measured from the symmetric axis of the cone. A positive
  24. // angle results in a cone apex on the opposite direction of the
  25. // symmetric axis, and vice versa for a negative angle.
  26. // Parameter u is the angle of revolution measured from the refAxis
  27. // (an axis perpendicular to the axis of symmetry). For a closed cone,
  28. // it defaults to [-PI, PI). Right hand rule applied along the
  29. // direction of the axis of symmetry defines the positive direction
  30. // of u. The surface is periodic in u with a period of 2PI.
  31. // Parameter v varies along the generating line. v = 0 correspond
  32. // to the base of the cone. v is dimensionless and increases in the
  33. // direction the axis of symmetry. It is scaled against the initial
  34. // base radius of the cone.
  35. // [umin, umax] x [vmin, vmax] defines a four sided conical patch
  36. // bounded by two straight lines (at angles umin and umax), and two
  37. // circular arcs (at vmin and vmax). Following must be observed
  38. // when defining a cone.
  39. // umin < umax and |umin - umax| <= 2PI.
  40. // Base radius > 0.0
  41. // The hight of the cone is specified relative to its origin
  42. // (with the height increasing in the direction of the symetric
  43. // axis).
  44. //
  45. #ifndef AC_GECONE_H
  46. #define AC_GECONE_H
  47. #include "gegbl.h"
  48. #include "geintrvl.h"
  49. #include "gevec3d.h"
  50. #include "gesurf.h"
  51. #include "gearc3d.h"
  52. #pragma pack (push, 8)
  53. class AcGePoint3d;
  54. class AcGeVector3d;
  55. class AcGeCircArc3d;
  56. class AcGeInterval;
  57. class AcGeLinearEnt3d;
  58. class
  59. GX_DLLEXPIMPORT
  60. AcGeCone : public AcGeSurface
  61. {
  62. public:
  63. AcGeCone();
  64. AcGeCone(double cosineAngle, double sineAngle,
  65. const AcGePoint3d& baseOrigin, double baseRadius,
  66. const AcGeVector3d& axisOfSymmetry);
  67. AcGeCone(double cosineAngle, double sineAngle,
  68. const AcGePoint3d& baseOrigin, double baseRadius,
  69. const AcGeVector3d& axisOfSymmetry,
  70. const AcGeVector3d& refAxis, const AcGeInterval& height,
  71. double startAngle, double endAngle);
  72. AcGeCone(const AcGeCone& cone);
  73. // Geometric properties.
  74. //
  75. double baseRadius () const;
  76. AcGePoint3d baseCenter () const;
  77. void getAngles (double& start, double& end) const;
  78. double halfAngle () const;
  79. void getHalfAngle (double& cosineAngle, double& sineAngle)
  80. const;
  81. void getHeight (AcGeInterval& range) const;
  82. double heightAt (double u) const;
  83. AcGeVector3d axisOfSymmetry () const;
  84. AcGeVector3d refAxis () const;
  85. AcGePoint3d apex () const;
  86. Adesk::Boolean isClosed (const AcGeTol& tol = AcGeContext::gTol) const;
  87. Adesk::Boolean isOuterNormal () const;
  88. AcGeCone& setBaseRadius (double radius);
  89. AcGeCone& setAngles (double startAngle, double endAngle);
  90. AcGeCone& setHeight (const AcGeInterval& height);
  91. AcGeCone& set (double cosineAngle, double sineAngle,
  92. const AcGePoint3d& baseCenter,
  93. double baseRadius,
  94. const AcGeVector3d& axisOfSymmetry);
  95. AcGeCone& set (double cosineAngle, double sineAngle,
  96. const AcGePoint3d& baseCenter,
  97. double baseRadius,
  98. const AcGeVector3d& axisOfSymmetry,
  99. const AcGeVector3d& refAxis,
  100. const AcGeInterval& height,
  101. double startAngle, double endAngle);
  102. // Assignment operator.
  103. //
  104. AcGeCone& operator = (const AcGeCone& cone);
  105. // Intersection with a linear entity
  106. //
  107. Adesk::Boolean intersectWith (const AcGeLinearEnt3d& linEnt, int& intn,
  108. AcGePoint3d& p1, AcGePoint3d& p2,
  109. const AcGeTol& tol = AcGeContext::gTol) const;
  110. };
  111. #pragma pack (pop)
  112. #endif