0031642: Visualization - crash in Graphic3d_Structure::SetVisual() on redisplaying...
[occt.git] / src / BndLib / BndLib_AddSurface.hxx
CommitLineData
42cf5bc1 1// Created on: 1995-07-24
2// Created by: Modelistation
3// Copyright (c) 1995-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_AddSurface_HeaderFile
18#define _BndLib_AddSurface_HeaderFile
19
20#include <Standard.hxx>
21#include <Standard_DefineAlloc.hxx>
22#include <Standard_Handle.hxx>
23
24#include <Standard_Real.hxx>
25class Adaptor3d_Surface;
26class Bnd_Box;
3ba87fdb 27class gp_Cylinder;
28class gp_Cone;
29class gp_Sphere;
42cf5bc1 30
31//! computes the box from a surface
32//! Functions to add a surface to a bounding box.
33//! The surface is defined from a Geom surface.
34class BndLib_AddSurface
35{
36public:
37
38 DEFINE_STANDARD_ALLOC
39
40
41 //! Adds to the bounding box B the surface S
42 //! B is then enlarged by the tolerance value Tol.
43 //! Note: depending on the type of curve, one of the following
44 //! representations of the surface S is used to include it in the bounding box B:
45 //! - an exact representation if S is built from a plane, a
46 //! cylinder, a cone, a sphere or a torus,
47 //! - the poles of the surface if S is built from a Bezier
48 //! surface or a BSpline surface,
49 //! - the points of an approximation of the surface S in
50 //! cases other than offset surfaces;
51 //! - in the case of an offset surface, the basis surface is first
52 //! included according to the previous rules; then the
53 //! bounding box is enlarged by the offset value.
54 //! Warning
55 //! Do not use these functions to add a non-finite surface to
56 //! the bounding box B.
57 //! If UMin, UMax, VMin or VMax is an infinite value B will become WholeSpace.
58 //! S is an adapted surface, that is, an object which is an interface between:
59 //! - the services provided by a surface from the package Geom
60 //! - and those required of the surface by the computation algorithm.
61 //! The adapted surface is created in the following way:
62 //! Handle(Geom_Surface) mysurface = ... ;
63 //! GeomAdaptor_Surface S(mysurface);
64 //! The bounding box B is then enlarged by adding this surface:
65 //! Bnd_Box B;
66 //! // ...
67 //! Standard_Real Tol = ... ;
68 //! AddSurface::Add ( S, Tol, B );
69 Standard_EXPORT static void Add (const Adaptor3d_Surface& S, const Standard_Real Tol, Bnd_Box& B);
70
71 //! Adds to the bounding box B the surface S
72 //! the patch of the surface S limited in the u parametric
73 //! direction by the two parameter values UMin, UMax, and
74 //! in the v parametric direction by the two parameter
75 //! values VMin, VMax.
76 //! Note: depending on the type of curve, one of the following
77 //! representations of the surface S is used to include it in the bounding box B:
78 //! - an exact representation if S is built from a plane, a
79 //! cylinder, a cone, a sphere or a torus,
80 //! - the poles of the surface if S is built from a Bezier
81 //! surface or a BSpline surface,
82 //! - the points of an approximation of the surface S in
83 //! cases other than offset surfaces;
84 //! - in the case of an offset surface, the basis surface is first
85 //! included according to the previous rules; then the
86 //! bounding box is enlarged by the offset value.
87 //! Warning
88 //! Do not use these functions to add a non-finite surface to
89 //! the bounding box B.
90 //! If UMin, UMax, VMin or VMax is an infinite value B will become WholeSpace.
91 //! S is an adapted surface, that is, an object which is an interface between:
92 //! - the services provided by a surface from the package Geom
93 //! - and those required of the surface by the computation algorithm.
94 //! The adapted surface is created in the following way:
95 //! Handle(Geom_Surface) mysurface = ... ;
96 //! GeomAdaptor_Surface S(mysurface);
97 //! The bounding box B is then enlarged by adding this surface:
98 //! Bnd_Box B;
99 //! // ...
100 //! Standard_Real Tol = ... ;
101 //! AddSurface::Add ( S, Tol, B );
102 Standard_EXPORT static void Add (const Adaptor3d_Surface& S, const Standard_Real UMin, const Standard_Real UMax, const Standard_Real VMin, const Standard_Real VMax, const Standard_Real Tol, Bnd_Box& B);
103
3ba87fdb 104 //! Adds the surface S to the bounding box B.
105 //! This algorith builds precise bounding box
42cf5bc1 106
3ba87fdb 107 Standard_EXPORT static void AddOptimal (const Adaptor3d_Surface& S, const Standard_Real Tol, Bnd_Box& B);
42cf5bc1 108
3ba87fdb 109 Standard_EXPORT static void AddOptimal (const Adaptor3d_Surface& S,
110 const Standard_Real UMin, const Standard_Real UMax,
111 const Standard_Real VMin, const Standard_Real VMax,
112 const Standard_Real Tol, Bnd_Box& B);
42cf5bc1 113
42cf5bc1 114
3ba87fdb 115 //! Adds to the bounding box B the surface S
116 //! using numerical minimization algorithms
117 //! This method is used in AddOptimal for not analytical surfaces and torus.
118 //! if Tol < Precision::Confusion(), Precision::Confusion is used as computation tolerance
119 Standard_EXPORT static void AddGenSurf(const Adaptor3d_Surface& S,
120 const Standard_Real UMin,
121 const Standard_Real UMax,
122 const Standard_Real VMin,
123 const Standard_Real VMax,
124 const Standard_Real Tol,
125 Bnd_Box& B);
42cf5bc1 126
3ba87fdb 127protected:
42cf5bc1 128
129
130
42cf5bc1 131
132
3ba87fdb 133private:
42cf5bc1 134
135
136
137};
138
139
140
141
142
143
144
145#endif // _BndLib_AddSurface_HeaderFile