42cf5bc1 |
1 | // Created on: 1993-07-09 |
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_Add2dCurve_HeaderFile |
18 | #define _BndLib_Add2dCurve_HeaderFile |
19 | |
20 | #include <Standard.hxx> |
21 | #include <Standard_DefineAlloc.hxx> |
22 | #include <Standard_Handle.hxx> |
23 | |
42cf5bc1 |
24 | class Adaptor2d_Curve2d; |
25 | class Bnd_Box2d; |
26 | class Geom2d_Curve; |
27 | |
28 | |
29 | //! Computes the bounding box for a curve in 2d . |
30 | //! Functions to add a 2D curve to a bounding box. |
31 | //! The 2D curve is defined from a Geom2d curve. |
32 | class BndLib_Add2dCurve |
33 | { |
34 | public: |
35 | |
36 | DEFINE_STANDARD_ALLOC |
37 | |
38 | |
39 | //! Adds to the bounding box B the curve C |
40 | //! B is then enlarged by the tolerance value Tol. |
41 | //! Note: depending on the type of curve, one of the following |
42 | //! representations of the curve C is used to include it in the bounding box B: |
43 | //! - an exact representation if C is built from a line, a circle or a conic curve, |
44 | //! - the poles of the curve if C is built from a Bezier curve or a BSpline curve, |
45 | //! - if not, the points of an approximation of the curve C. |
46 | //! Warning |
47 | //! C is an adapted curve, that is, an object which is an interface between: |
48 | //! - the services provided by a 2D curve from the package Geom2d |
49 | //! - and those required of the curve by the computation algorithm. |
50 | //! The adapted curve is created in the following way: |
51 | //! Handle(Geom2d_Curve) mycurve = ... |
52 | //! ; |
53 | //! Geom2dAdaptor_Curve C(mycurve); |
54 | //! The bounding box B is then enlarged by adding it: |
55 | //! Bnd_Box2d B; |
56 | //! // ... |
57 | //! Standard_Real Tol = ... ; |
58 | //! Add2dCurve::Add ( C, Tol, B ); |
59 | //! Exceptions |
60 | //! Standard_Failure if the curve is built from: |
61 | //! - a Geom_Line, or |
62 | //! - a Geom_Parabola, or |
63 | //! - a Geom_Hyperbola, |
64 | //! and P1 and P2 are either two negative infinite real |
65 | //! numbers, or two positive infinite real numbers. |
66 | Standard_EXPORT static void Add (const Adaptor2d_Curve2d& C, const Standard_Real Tol, Bnd_Box2d& B); |
67 | |
68 | //! Adds to the bounding box Bthe arc of the curve C limited by the two parameter |
69 | //! values P1 and P2. |
70 | //! B is then enlarged by the tolerance value Tol. |
71 | //! Note: depending on the type of curve, one of the following |
72 | //! representations of the curve C is used to include it in the bounding box B: |
73 | //! - an exact representation if C is built from a line, a circle or a conic curve, |
74 | //! - the poles of the curve if C is built from a Bezier curve or a BSpline curve, |
75 | //! - if not, the points of an approximation of the curve C. |
76 | //! Warning |
77 | //! C is an adapted curve, that is, an object which is an interface between: |
78 | //! - the services provided by a 2D curve from the package Geom2d |
79 | //! - and those required of the curve by the computation algorithm. |
80 | //! The adapted curve is created in the following way: |
81 | //! Handle(Geom2d_Curve) mycurve = ... |
82 | //! ; |
83 | //! Geom2dAdaptor_Curve C(mycurve); |
84 | //! The bounding box B is then enlarged by adding it: |
85 | //! Bnd_Box2d B; |
86 | //! // ... |
87 | //! Standard_Real Tol = ... ; |
88 | //! Add2dCurve::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 Adaptor2d_Curve2d& C, const Standard_Real U1, const Standard_Real U2, const Standard_Real Tol, Bnd_Box2d& B); |
97 | |
98 | //! Adds to the bounding box B the curve C |
99 | //! B is then enlarged by the tolerance value Tol. |
100 | //! Note: depending on the type of curve, one of the following |
101 | //! representations of the curve C is used to include it in the bounding box B: |
102 | //! - an exact representation if C is built from a line, a circle or a conic curve, |
103 | //! - the poles of the curve if C is built from a Bezier curve or a BSpline curve, |
104 | //! - if not, the points of an approximation of the curve C. |
105 | Standard_EXPORT static void Add (const Handle(Geom2d_Curve)& C, const Standard_Real Tol, Bnd_Box2d& Box); |
106 | |
107 | //! Adds to the bounding box B the part of curve C |
108 | //! B is then enlarged by the tolerance value Tol. |
4551e1be |
109 | //! U1, U2 - the parametric range to compute the bounding box; |
42cf5bc1 |
110 | //! Note: depending on the type of curve, one of the following |
111 | //! representations of the curve C is used to include it in the bounding box B: |
112 | //! - an exact representation if C is built from a line, a circle or a conic curve, |
113 | //! - the poles of the curve if C is built from a Bezier curve or a BSpline curve, |
114 | //! - if not, the points of an approximation of the curve C. |
115 | Standard_EXPORT static void Add (const Handle(Geom2d_Curve)& C, const Standard_Real U1, const Standard_Real U2, const Standard_Real Tol, Bnd_Box2d& B); |
116 | |
3ba87fdb |
117 | //! Adds to the bounding box B the part of curve C |
118 | //! B is then enlarged by the tolerance value Tol. |
4551e1be |
119 | //! U1, U2 - the parametric range to compute the bounding box; |
3ba87fdb |
120 | //! Note: depending on the type of curve, one of the following |
121 | //! algorithms is used to include it in the bounding box B: |
122 | //! - an exact analytical if C is built from a line, a circle or a conic curve, |
123 | //! - numerical calculation of bounding box sizes, based on minimization algorithm, for other types of curve |
124 | //! If Tol = < Precision::PConfusion(), Precision::PConfusion is used as tolerance for calculation |
125 | Standard_EXPORT static void AddOptimal(const Handle(Geom2d_Curve)& C, |
126 | const Standard_Real U1, |
127 | const Standard_Real U2, |
128 | const Standard_Real Tol, |
129 | Bnd_Box2d& B); |
42cf5bc1 |
130 | |
131 | |
132 | protected: |
133 | |
134 | |
135 | |
136 | |
137 | |
138 | private: |
139 | |
140 | |
141 | |
142 | |
143 | |
144 | }; |
145 | |
146 | |
147 | |
148 | |
149 | |
150 | |
151 | |
152 | #endif // _BndLib_Add2dCurve_HeaderFile |