Commit | Line | Data |
---|---|---|

42cf5bc1 | 1 | // Created on: 1993-07-08 |

2 | // Created by: Isabelle GRIGNON | |

3 | // Copyright (c) 1993-1999 Matra Datavision | |

4 | // Copyright (c) 1999-2014 OPEN CASCADE SAS | |

5 | // | |

6 | // This file is part of Open CASCADE Technology software library. | |

7 | // | |

8 | // This library is free software; you can redistribute it and/or modify it under | |

9 | // the terms of the GNU Lesser General Public License version 2.1 as published | |

10 | // by the Free Software Foundation, with special exception defined in the file | |

11 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT | |

12 | // distribution for complete text of the license and disclaimer of any warranty. | |

13 | // | |

14 | // Alternatively, this file may be used under the terms of Open CASCADE | |

15 | // commercial license or contractual agreement. | |

16 | ||

17 | #ifndef _BndLib_Add3dCurve_HeaderFile | |

18 | #define _BndLib_Add3dCurve_HeaderFile | |

19 | ||

20 | #include <Standard.hxx> | |

21 | #include <Standard_DefineAlloc.hxx> | |

22 | #include <Standard_Handle.hxx> | |

23 | ||

24 | #include <Standard_Real.hxx> | |

3ba87fdb | 25 | // |

42cf5bc1 | 26 | class Adaptor3d_Curve; |

27 | class Bnd_Box; | |

3ba87fdb | 28 | class gp_Circ; |

29 | class gp_Elips; | |

42cf5bc1 | 30 | |

31 | ||

32 | //! Computes the bounding box for a curve in 3d. | |

33 | //! Functions to add a 3D curve to a bounding box. | |

34 | //! The 3D curve is defined from a Geom curve. | |

35 | class BndLib_Add3dCurve | |

36 | { | |

37 | public: | |

38 | ||

39 | DEFINE_STANDARD_ALLOC | |

40 | ||

41 | ||

42 | //! Adds to the bounding box B the curve C | |

43 | //! B is then enlarged by the tolerance value Tol. | |

44 | //! Note: depending on the type of curve, one of the following | |

45 | //! representations of the curve C is used to include it in the bounding box B: | |

46 | //! - an exact representation if C is built from a line, a circle or a conic curve, | |

47 | //! - the poles of the curve if C is built from a Bezier curve or a BSpline curve, | |

48 | //! if not, the points of an approximation of the curve C. | |

49 | //! Warning | |

50 | //! C is an adapted curve, that is, an object which is an interface between: | |

51 | //! - the services provided by a 3D curve from the package Geom | |

52 | //! - and those required of the curve by the computation algorithm. | |

53 | //! The adapted curve is created in the following way: | |

54 | //! Handle(Geom_Curve) mycurve = ... ; | |

55 | //! GeomAdaptor_Curve C(mycurve); | |

56 | //! The bounding box B is then enlarged by adding it: | |

57 | //! Bnd_Box B; | |

58 | //! // ... | |

59 | //! Standard_Real Tol = ... ; | |

60 | //! Add3dCurve::Add ( C, Tol, B ); | |

61 | //! Exceptions | |

62 | //! Standard_Failure if the curve is built from: | |

63 | //! - a Geom_Line, or | |

64 | //! - a Geom_Parabola, or | |

65 | //! - a Geom_Hyperbola, | |

66 | //! and P1 and P2 are either two negative infinite real | |

67 | //! numbers, or two positive infinite real numbers. | |

68 | Standard_EXPORT static void Add (const Adaptor3d_Curve& C, const Standard_Real Tol, Bnd_Box& B); | |

69 | ||

70 | //! Adds to the bounding box B the curve C | |

71 | //! the arc of the curve C limited by the two parameter values P1 and P2. | |

72 | //! Note: depending on the type of curve, one of the following | |

73 | //! representations of the curve C is used to include it in the bounding box B: | |

74 | //! - an exact representation if C is built from a line, a circle or a conic curve, | |

75 | //! - the poles of the curve if C is built from a Bezier curve or a BSpline curve, | |

76 | //! if not, the points of an approximation of the curve C. | |

77 | //! Warning | |

78 | //! C is an adapted curve, that is, an object which is an interface between: | |

79 | //! - the services provided by a 3D curve from the package Geom | |

80 | //! - and those required of the curve by the computation algorithm. | |

81 | //! The adapted curve is created in the following way: | |

82 | //! Handle(Geom_Curve) mycurve = ... ; | |

83 | //! GeomAdaptor_Curve C(mycurve); | |

84 | //! The bounding box B is then enlarged by adding it: | |

85 | //! Bnd_Box B; | |

86 | //! // ... | |

87 | //! Standard_Real Tol = ... ; | |

88 | //! Add3dCurve::Add ( C, Tol, B ); | |

89 | //! Exceptions | |

90 | //! Standard_Failure if the curve is built from: | |

91 | //! - a Geom_Line, or | |

92 | //! - a Geom_Parabola, or | |

93 | //! - a Geom_Hyperbola, | |

94 | //! and P1 and P2 are either two negative infinite real | |

95 | //! numbers, or two positive infinite real numbers. | |

96 | Standard_EXPORT static void Add (const Adaptor3d_Curve& C, const Standard_Real U1, const Standard_Real U2, const Standard_Real Tol, Bnd_Box& B); | |

97 | ||

3ba87fdb | 98 | //! Adds to the bounding box B the curve C |

99 | //! These methods use more precise algorithms for building bnd box | |

100 | //! then methods Add(...) | |

101 | Standard_EXPORT static void AddOptimal (const Adaptor3d_Curve& C, const Standard_Real Tol, Bnd_Box& B); | |

102 | Standard_EXPORT static void AddOptimal (const Adaptor3d_Curve& C, | |

103 | const Standard_Real U1, const Standard_Real U2, | |

104 | const Standard_Real Tol, Bnd_Box& B); | |

105 | //! Adds to the bounding box B the curve C | |

106 | //! using numerical minimization algorithms | |

107 | //! This method is used in AddOptimal for not analytical curves. | |

108 | //! if Tol < Precision::Confusion(), Precision:;Confusion is used as computation tolerance | |

109 | Standard_EXPORT static void AddGenCurv(const Adaptor3d_Curve& C, | |

110 | const Standard_Real UMin, | |

111 | const Standard_Real UMax, | |

112 | const Standard_Real Tol, | |

113 | Bnd_Box& B); | |

42cf5bc1 | 114 | |

115 | protected: | |

116 | ||

117 | ||

118 | ||

119 | ||

120 | ||

121 | private: | |

122 | ||

123 | ||

124 | ||

125 | ||

126 | ||

127 | }; | |

128 | ||

129 | ||

130 | ||

131 | ||

132 | ||

133 | ||

134 | ||

135 | #endif // _BndLib_Add3dCurve_HeaderFile |