genurb3d.h 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  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 class AcGeNurbCurve3d - A mathematical entity
  15. // used to represent a different types of spline curves in 3-space.
  16. #ifndef AC_GENURB3D_H
  17. #define AC_GENURB3D_H
  18. #include "gecurv3d.h"
  19. #include "geintrvl.h"
  20. #include "gekvec.h"
  21. #include "gept3dar.h"
  22. #include "gevec3d.h"
  23. #include "gepnt3d.h"
  24. #include "gesent3d.h"
  25. #include "geplin3d.h"
  26. #include "gedblar.h"
  27. #include "gept3dar.h"
  28. #include "gevc3dar.h"
  29. #pragma pack (push, 8)
  30. class AcGeEllipArc3d;
  31. class AcGeLineSeg3d;
  32. class
  33. GE_DLLEXPIMPORT
  34. AcGeNurbCurve3d : public AcGeSplineEnt3d
  35. {
  36. public:
  37. // Construct spline from control points.
  38. //
  39. AcGeNurbCurve3d ();
  40. AcGeNurbCurve3d (const AcGeNurbCurve3d& src );
  41. AcGeNurbCurve3d (int degree, const AcGeKnotVector& knots,
  42. const AcGePoint3dArray& cntrlPnts,
  43. Adesk::Boolean isPeriodic = Adesk::kFalse );
  44. AcGeNurbCurve3d (int degree, const AcGeKnotVector& knots,
  45. const AcGePoint3dArray& cntrlPnts,
  46. const AcGeDoubleArray& weights,
  47. Adesk::Boolean isPeriodic = Adesk::kFalse );
  48. // Construct spline from interpolation data.
  49. //
  50. AcGeNurbCurve3d (int degree, const AcGePolyline3d& fitPolyline,
  51. Adesk::Boolean isPeriodic = Adesk::kFalse );
  52. AcGeNurbCurve3d (const AcGePoint3dArray& fitPoints,
  53. const AcGeVector3d& startTangent,
  54. const AcGeVector3d& endTangent,
  55. Adesk::Boolean startTangentDefined = Adesk::kTrue,
  56. Adesk::Boolean endTangentDefined = Adesk::kTrue,
  57. const AcGeTol& fitTolerance = AcGeContext::gTol);
  58. // specify the fitting points and the wanted knot parameterization
  59. AcGeNurbCurve3d (const AcGePoint3dArray& fitPoints,
  60. const AcGeVector3d& startTangent,
  61. const AcGeVector3d& endTangent,
  62. Adesk::Boolean startTangentDefined,
  63. Adesk::Boolean endTangentDefined,
  64. AcGe::KnotParameterization knotParam,
  65. const AcGeTol& fitTolerance = AcGeContext::gTol);
  66. AcGeNurbCurve3d (const AcGePoint3dArray& fitPoints,
  67. const AcGeTol& fitTolerance = AcGeContext::gTol);
  68. AcGeNurbCurve3d (const AcGePoint3dArray& fitPoints,
  69. const AcGeVector3dArray& fitTangents,
  70. const AcGeTol& fitTolerance = AcGeContext::gTol,
  71. Adesk::Boolean isPeriodic = Adesk::kFalse);
  72. // Construct a cubic spline approximating the curve
  73. AcGeNurbCurve3d(const AcGeCurve3d& curve,
  74. double epsilon = AcGeContext::gTol.equalPoint());
  75. // Spline representation of ellipse
  76. //
  77. AcGeNurbCurve3d (const AcGeEllipArc3d& ellipse);
  78. // Spline representation of line segment
  79. //
  80. AcGeNurbCurve3d (const AcGeLineSeg3d& linSeg);
  81. // Query methods.
  82. //
  83. int numFitPoints () const;
  84. Adesk::Boolean getFitPointAt (int index, AcGePoint3d& point) const;
  85. Adesk::Boolean getFitTolerance (AcGeTol& fitTolerance) const;
  86. Adesk::Boolean getFitTangents (AcGeVector3d& startTangent,
  87. AcGeVector3d& endTangent) const;
  88. Adesk::Boolean getFitTangents (AcGeVector3d& startTangent,
  89. AcGeVector3d& endTangent,
  90. Adesk::Boolean& startTangentDefined,
  91. Adesk::Boolean& endTangentDefined) const;
  92. Adesk::Boolean getFitKnotParameterization(KnotParameterization& knotParam) const;
  93. Adesk::Boolean getFitData (AcGePoint3dArray& fitPoints,
  94. AcGeTol& fitTolerance,
  95. Adesk::Boolean& tangentsExist,
  96. AcGeVector3d& startTangent,
  97. AcGeVector3d& endTangent) const;
  98. Adesk::Boolean getFitData (AcGePoint3dArray& fitPoints,
  99. AcGeTol& fitTolerance,
  100. Adesk::Boolean& tangentsExist,
  101. AcGeVector3d& startTangent,
  102. AcGeVector3d& endTangent,
  103. KnotParameterization& knotParam) const;
  104. void getDefinitionData (int& degree, Adesk::Boolean& rational,
  105. Adesk::Boolean& periodic,
  106. AcGeKnotVector& knots,
  107. AcGePoint3dArray& controlPoints,
  108. AcGeDoubleArray& weights) const;
  109. int numWeights () const;
  110. double weightAt (int idx) const;
  111. Adesk::Boolean evalMode () const;
  112. Adesk::Boolean getParamsOfC1Discontinuity (AcGeDoubleArray& params,
  113. const AcGeTol& tol
  114. = AcGeContext::gTol) const;
  115. Adesk::Boolean getParamsOfG1Discontinuity (AcGeDoubleArray& params,
  116. const AcGeTol& tol
  117. = AcGeContext::gTol) const;
  118. // Modification methods.
  119. //
  120. Adesk::Boolean setFitPointAt (int index, const AcGePoint3d& point);
  121. Adesk::Boolean addFitPointAt (int index, const AcGePoint3d& point);
  122. Adesk::Boolean deleteFitPointAt (int index);
  123. Adesk::Boolean setFitTolerance (const AcGeTol& fitTol=AcGeContext::gTol);
  124. Adesk::Boolean setFitTangents (const AcGeVector3d& startTangent,
  125. const AcGeVector3d& endTangent);
  126. Adesk::Boolean setFitTangents (const AcGeVector3d& startTangent,
  127. const AcGeVector3d& endTangent,
  128. Adesk::Boolean startTangentDefined,
  129. Adesk::Boolean endTangentDefined) const;
  130. Adesk::Boolean setFitKnotParameterization(KnotParameterization knotParam);
  131. AcGeNurbCurve3d& setFitData (const AcGePoint3dArray& fitPoints,
  132. const AcGeVector3d& startTangent,
  133. const AcGeVector3d& endTangent,
  134. const AcGeTol& fitTol=AcGeContext::gTol);
  135. AcGeNurbCurve3d& setFitData (const AcGePoint3dArray& fitPoints,
  136. const AcGeVector3d& startTangent,
  137. const AcGeVector3d& endTangent,
  138. KnotParameterization knotParam,
  139. const AcGeTol& fitTol=AcGeContext::gTol);
  140. AcGeNurbCurve3d& setFitData (const AcGeKnotVector& fitKnots,
  141. const AcGePoint3dArray& fitPoints,
  142. const AcGeVector3d& startTangent,
  143. const AcGeVector3d& endTangent,
  144. const AcGeTol& fitTol=AcGeContext::gTol,
  145. Adesk::Boolean isPeriodic=Adesk::kFalse);
  146. AcGeNurbCurve3d& setFitData (int degree,
  147. const AcGePoint3dArray& fitPoints,
  148. const AcGeTol& fitTol=AcGeContext::gTol);
  149. Adesk::Boolean purgeFitData ();
  150. Adesk::Boolean buildFitData ();
  151. Adesk::Boolean buildFitData (KnotParameterization kp);
  152. AcGeNurbCurve3d& addKnot (double newKnot);
  153. AcGeNurbCurve3d& insertKnot (double newKnot);
  154. AcGeSplineEnt3d& setWeightAt (int idx, double val);
  155. AcGeNurbCurve3d& setEvalMode (Adesk::Boolean evalMode=Adesk::kFalse );
  156. AcGeNurbCurve3d& joinWith (const AcGeNurbCurve3d& curve);
  157. AcGeNurbCurve3d& hardTrimByParams(double newStartParam,
  158. double newEndParam);
  159. AcGeNurbCurve3d& makeRational (double weight = 1.0);
  160. AcGeNurbCurve3d& makeClosed ();
  161. AcGeNurbCurve3d& makePeriodic ();
  162. AcGeNurbCurve3d& makeNonPeriodic ();
  163. AcGeNurbCurve3d& makeOpen ();
  164. AcGeNurbCurve3d& elevateDegree (int plusDegree);
  165. // add/remove control point.
  166. Adesk::Boolean addControlPointAt(double newKnot, const AcGePoint3d& point, double weight = 1.0);
  167. Adesk::Boolean deleteControlPointAt(int index);
  168. // Assignment operator.
  169. //
  170. AcGeNurbCurve3d& operator = (const AcGeNurbCurve3d& spline);
  171. };
  172. #pragma pack (pop)
  173. #endif