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
6 // This file is part of Open CASCADE Technology software library.
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.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #ifndef _BndLib_Add2dCurve_HeaderFile
18 #define _BndLib_Add2dCurve_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
24 #include <Standard_Real.hxx>
25 class Adaptor2d_Curve2d;
30 //! Computes the bounding box for a curve in 2d .
31 //! Functions to add a 2D curve to a bounding box.
32 //! The 2D curve is defined from a Geom2d curve.
33 class BndLib_Add2dCurve
40 //! Adds to the bounding box B the curve C
41 //! B is then enlarged by the tolerance value Tol.
42 //! Note: depending on the type of curve, one of the following
43 //! representations of the curve C is used to include it in the bounding box B:
44 //! - an exact representation if C is built from a line, a circle or a conic curve,
45 //! - the poles of the curve if C is built from a Bezier curve or a BSpline curve,
46 //! - if not, the points of an approximation of the curve C.
48 //! C is an adapted curve, that is, an object which is an interface between:
49 //! - the services provided by a 2D curve from the package Geom2d
50 //! - and those required of the curve by the computation algorithm.
51 //! The adapted curve is created in the following way:
52 //! Handle(Geom2d_Curve) mycurve = ...
54 //! Geom2dAdaptor_Curve C(mycurve);
55 //! The bounding box B is then enlarged by adding it:
58 //! Standard_Real Tol = ... ;
59 //! Add2dCurve::Add ( C, Tol, B );
61 //! Standard_Failure if the curve is built from:
63 //! - a Geom_Parabola, or
64 //! - a Geom_Hyperbola,
65 //! and P1 and P2 are either two negative infinite real
66 //! numbers, or two positive infinite real numbers.
67 Standard_EXPORT static void Add (const Adaptor2d_Curve2d& C, const Standard_Real Tol, Bnd_Box2d& B);
69 //! Adds to the bounding box Bthe arc of the curve C limited by the two parameter
71 //! B is then enlarged by the tolerance value Tol.
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.
78 //! C is an adapted curve, that is, an object which is an interface between:
79 //! - the services provided by a 2D curve from the package Geom2d
80 //! - and those required of the curve by the computation algorithm.
81 //! The adapted curve is created in the following way:
82 //! Handle(Geom2d_Curve) mycurve = ...
84 //! Geom2dAdaptor_Curve C(mycurve);
85 //! The bounding box B is then enlarged by adding it:
88 //! Standard_Real Tol = ... ;
89 //! Add2dCurve::Add ( C, Tol, B );
91 //! Standard_Failure if the curve is built from:
93 //! - a Geom_Parabola, or
94 //! - a Geom_Hyperbola,
95 //! and P1 and P2 are either two negative infinite real
96 //! numbers, or two positive infinite real numbers.
97 Standard_EXPORT static void Add (const Adaptor2d_Curve2d& C, const Standard_Real U1, const Standard_Real U2, const Standard_Real Tol, Bnd_Box2d& B);
99 //! Adds to the bounding box B the curve C
100 //! B is then enlarged by the tolerance value Tol.
101 //! Note: depending on the type of curve, one of the following
102 //! representations of the curve C is used to include it in the bounding box B:
103 //! - an exact representation if C is built from a line, a circle or a conic curve,
104 //! - the poles of the curve if C is built from a Bezier curve or a BSpline curve,
105 //! - if not, the points of an approximation of the curve C.
106 Standard_EXPORT static void Add (const Handle(Geom2d_Curve)& C, const Standard_Real Tol, Bnd_Box2d& Box);
108 //! Adds to the bounding box B the part of curve C
109 //! B is then enlarged by the tolerance value Tol.
110 //! U1, U2 - the parametric range to comute the bounding box;
111 //! Note: depending on the type of curve, one of the following
112 //! representations of the curve C is used to include it in the bounding box B:
113 //! - an exact representation if C is built from a line, a circle or a conic curve,
114 //! - the poles of the curve if C is built from a Bezier curve or a BSpline curve,
115 //! - if not, the points of an approximation of the curve C.
116 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);
118 //! Adds to the bounding box B the part of curve C
119 //! B is then enlarged by the tolerance value Tol.
120 //! U1, U2 - the parametric range to comute the bounding box;
121 //! Note: depending on the type of curve, one of the following
122 //! algorithms is used to include it in the bounding box B:
123 //! - an exact analytical if C is built from a line, a circle or a conic curve,
124 //! - numerical calculation of bounding box sizes, based on minimization algorithm, for other types of curve
125 //! If Tol = < Precision::PConfusion(), Precision::PConfusion is used as tolerance for calculation
126 Standard_EXPORT static void AddOptimal(const Handle(Geom2d_Curve)& C,
127 const Standard_Real U1,
128 const Standard_Real U2,
129 const Standard_Real Tol,
153 #endif // _BndLib_Add2dCurve_HeaderFile