gearc2d.h 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  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 contains the class AcGeCircArc2d - A mathematical entity
  14. // used to represent a circular arc in 2-space.
  15. #ifndef AC_GEARC2D_H
  16. #define AC_GEARC2D_H
  17. #include "gecurv2d.h"
  18. #include "gepnt2d.h"
  19. #include "gevec2d.h"
  20. #pragma pack (push, 8)
  21. class AcGeLine2d;
  22. class AcGeLinearEnt2d;
  23. class
  24. GE_DLLEXPIMPORT
  25. AcGeCircArc2d : public AcGeCurve2d
  26. {
  27. public:
  28. AcGeCircArc2d();
  29. AcGeCircArc2d(const AcGeCircArc2d& arc);
  30. AcGeCircArc2d(const AcGePoint2d& cent, double radius);
  31. AcGeCircArc2d(const AcGePoint2d& cent, double radius,
  32. double startAngle, double endAngle,
  33. const AcGeVector2d& refVec = AcGeVector2d::kXAxis,
  34. Adesk::Boolean isClockWise = Adesk::kFalse);
  35. AcGeCircArc2d(const AcGePoint2d& startPoint, const AcGePoint2d& point,
  36. const AcGePoint2d& endPoint);
  37. // If bulgeFlag is kTrue, then bulge is interpreted to be the maximum
  38. // distance between the arc and the chord between the two input points.
  39. // If bulgeFlag is kFalse, then bulge is interpreted to be tan(ang/4),
  40. // where ang is the angle of the arc segment between the two input points.
  41. AcGeCircArc2d(const AcGePoint2d& startPoint, const AcGePoint2d& endPoint, double bulge,
  42. Adesk::Boolean bulgeFlag = Adesk::kTrue);
  43. // Intersection with other geometric objects.
  44. //
  45. Adesk::Boolean intersectWith (const AcGeLinearEnt2d& line, int& intn,
  46. AcGePoint2d& p1, AcGePoint2d& p2,
  47. const AcGeTol& tol = AcGeContext::gTol) const;
  48. Adesk::Boolean intersectWith (const AcGeCircArc2d& arc, int& intn,
  49. AcGePoint2d& p1, AcGePoint2d& p2,
  50. const AcGeTol& tol = AcGeContext::gTol) const;
  51. // Tangent line to the circular arc at given point.
  52. //
  53. Adesk::Boolean tangent (const AcGePoint2d& pnt, AcGeLine2d& line,
  54. const AcGeTol& tol = AcGeContext::gTol) const;
  55. Adesk::Boolean tangent (const AcGePoint2d& pnt, AcGeLine2d& line,
  56. const AcGeTol& tol, AcGeError& error) const;
  57. // Possible error conditions: kArg1TooBig, kArg1InsideThis,
  58. // kArg1OnThis
  59. // Test if point is inside circle.
  60. //
  61. Adesk::Boolean isInside (const AcGePoint2d& pnt,
  62. const AcGeTol& tol = AcGeContext::gTol) const;
  63. // Definition of circular arc
  64. //
  65. AcGePoint2d center () const;
  66. double radius () const;
  67. double startAng () const;
  68. double endAng () const;
  69. Adesk::Boolean isClockWise () const;
  70. AcGeVector2d refVec () const;
  71. AcGePoint2d startPoint () const;
  72. AcGePoint2d endPoint () const;
  73. AcGeCircArc2d& setCenter (const AcGePoint2d& cent);
  74. AcGeCircArc2d& setRadius (double radius);
  75. AcGeCircArc2d& setAngles (double startAng, double endAng);
  76. AcGeCircArc2d& setToComplement();
  77. AcGeCircArc2d& setRefVec (const AcGeVector2d& vec);
  78. AcGeCircArc2d& set (const AcGePoint2d& cent, double radius);
  79. AcGeCircArc2d& set (const AcGePoint2d& cent, double radius,
  80. double ang1, double ang2,
  81. const AcGeVector2d& refVec =
  82. AcGeVector2d::kXAxis,
  83. Adesk::Boolean isClockWise = Adesk::kFalse);
  84. AcGeCircArc2d& set (const AcGePoint2d& startPoint, const AcGePoint2d& pnt,
  85. const AcGePoint2d& endPoint);
  86. AcGeCircArc2d& set (const AcGePoint2d& startPoint, const AcGePoint2d& pnt,
  87. const AcGePoint2d& endPoint, AcGeError& error);
  88. // Possible errors: kEqualArg1Arg2, kEqualArg1Arg3, kEqualArg2Arg3,
  89. // kLinearlyDependentArg1Arg2Arg3.
  90. // Degenerate results: none.
  91. // On error, the object is unchanged.
  92. // If bulgeFlag is kTrue, then bulge is interpreted to be the maximum
  93. // distance between the arc and the chord between the two input points.
  94. // If bulgeFlag is kFalse, then bulge is interpreted to be tan(ang/4),
  95. // where ang is the angle of the arc segment between the two input points.
  96. AcGeCircArc2d& set (const AcGePoint2d& startPoint,
  97. const AcGePoint2d& endPoint,
  98. double bulge, Adesk::Boolean bulgeFlag = Adesk::kTrue);
  99. AcGeCircArc2d& set (const AcGeCurve2d& curve1,
  100. const AcGeCurve2d& curve2,
  101. double radius, double& param1, double& param2,
  102. Adesk::Boolean& success);
  103. // On success, this arc becomes the fillet of the given radius between the two curves,
  104. // whose points of tangency are nearest param1 and param2 respectively.
  105. AcGeCircArc2d& set (const AcGeCurve2d& curve1,
  106. const AcGeCurve2d& curve2,
  107. const AcGeCurve2d& curve3,
  108. double& param1, double& param2, double& param3,
  109. Adesk::Boolean& success);
  110. // Assignment operator.
  111. //
  112. AcGeCircArc2d& operator = (const AcGeCircArc2d& arc);
  113. };
  114. #pragma pack (pop)
  115. #endif