0031642: Visualization - crash in Graphic3d_Structure::SetVisual() on redisplaying...
[occt.git] / src / BndLib / BndLib_Add2dCurve.hxx
CommitLineData
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
24#include <Standard_Real.hxx>
25class Adaptor2d_Curve2d;
26class Bnd_Box2d;
27class Geom2d_Curve;
28
29
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.
33class BndLib_Add2dCurve
34{
35public:
36
37 DEFINE_STANDARD_ALLOC
38
39
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.
47 //! Warning
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 = ...
53 //! ;
54 //! Geom2dAdaptor_Curve C(mycurve);
55 //! The bounding box B is then enlarged by adding it:
56 //! Bnd_Box2d B;
57 //! // ...
58 //! Standard_Real Tol = ... ;
59 //! Add2dCurve::Add ( C, Tol, B );
60 //! Exceptions
61 //! Standard_Failure if the curve is built from:
62 //! - a Geom_Line, or
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);
68
69 //! Adds to the bounding box Bthe arc of the curve C limited by the two parameter
70 //! values P1 and P2.
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.
77 //! Warning
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 = ...
83 //! ;
84 //! Geom2dAdaptor_Curve C(mycurve);
85 //! The bounding box B is then enlarged by adding it:
86 //! Bnd_Box2d B;
87 //! // ...
88 //! Standard_Real Tol = ... ;
89 //! Add2dCurve::Add ( C, Tol, B );
90 //! Exceptions
91 //! Standard_Failure if the curve is built from:
92 //! - a Geom_Line, or
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);
98
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);
107
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);
117
3ba87fdb 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,
130 Bnd_Box2d& B);
42cf5bc1 131
132
133protected:
134
135
136
137
138
139private:
140
141
142
143
144
145};
146
147
148
149
150
151
152
153#endif // _BndLib_Add2dCurve_HeaderFile