1 // Created on: 1993-04-14
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 _BRepGProp_Face_HeaderFile
18 #define _BRepGProp_Face_HeaderFile
19 
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
23 
24 #include <BRepAdaptor_Surface.hxx>
25 #include <Geom2dAdaptor_Curve.hxx>
26 #include <Standard_Boolean.hxx>
27 #include <Standard_Integer.hxx>
28 #include <gp_Pnt2d.hxx>
29 #include <Standard_Real.hxx>
30 #include <TColStd_Array1OfReal.hxx>
31 #include <GeomAbs_IsoType.hxx>
32 #include <TColStd_HArray1OfReal.hxx>
33 class TopoDS_Face;
34 class gp_Pnt;
35 class gp_Vec;
36 class TopoDS_Edge;
37 class gp_Pnt2d;
38 class gp_Vec2d;
39 
40 
41 
42 class BRepGProp_Face
43 {
44 public:
45 
46   DEFINE_STANDARD_ALLOC
47 
48 
49   //! Constructor. Initializes the object with a flag IsUseSpan
50   //! that says if it is necessary to define spans on a face.
51   //! This option has an effect only for BSpline faces. Spans
52   //! are returned by the methods GetUKnots and GetTKnots.
53     BRepGProp_Face(const Standard_Boolean IsUseSpan = Standard_False);
54 
55   //! Constructor. Initializes the object with the face and the
56   //! flag IsUseSpan that says if it is necessary to define
57   //! spans on a face. This option has an effect only for
58   //! BSpline faces. Spans are returned by the methods GetUKnots
59   //! and GetTKnots.
60     BRepGProp_Face(const TopoDS_Face& F, const Standard_Boolean IsUseSpan = Standard_False);
61 
62   Standard_EXPORT void Load (const TopoDS_Face& F);
63 
64   Standard_EXPORT Standard_Integer VIntegrationOrder() const;
65 
66   //! Returns Standard_True if the face is not trimmed.
67     Standard_Boolean NaturalRestriction() const;
68 
69   //! Returns the TopoDS face.
70   const TopoDS_Face& GetFace() const;
71 
72   //! Returns the value of the boundary curve of the face.
73     gp_Pnt2d Value2d (const Standard_Real U) const;
74 
75   Standard_EXPORT Standard_Integer SIntOrder (const Standard_Real Eps) const;
76 
77   Standard_EXPORT Standard_Integer SVIntSubs() const;
78 
79   Standard_EXPORT Standard_Integer SUIntSubs() const;
80 
81   Standard_EXPORT void UKnots (TColStd_Array1OfReal& Knots) const;
82 
83   Standard_EXPORT void VKnots (TColStd_Array1OfReal& Knots) const;
84 
85   Standard_EXPORT Standard_Integer LIntOrder (const Standard_Real Eps) const;
86 
87   Standard_EXPORT Standard_Integer LIntSubs() const;
88 
89   Standard_EXPORT void LKnots (TColStd_Array1OfReal& Knots) const;
90 
91   //! Returns the number of points required to do the
92   //! integration in the U parametric direction with
93   //! a good accuracy.
94   Standard_EXPORT Standard_Integer UIntegrationOrder() const;
95 
96   //! Returns the parametric bounds of the Face.
97   Standard_EXPORT void Bounds (Standard_Real& U1, Standard_Real& U2, Standard_Real& V1, Standard_Real& V2) const;
98 
99   //! Computes the point of parameter U, V on the Face <S> and
100   //! the normal to the face at this point.
101   Standard_EXPORT void Normal (const Standard_Real U, const Standard_Real V, gp_Pnt& P, gp_Vec& VNor) const;
102 
103   //! Loading the boundary arc.
104   //! Returns FALSE if edge has no P-Curve.
105   Standard_EXPORT bool Load (const TopoDS_Edge& E);
106 
107   //! Returns the parametric value of the start point of
108   //! the current arc of curve.
109     Standard_Real FirstParameter() const;
110 
111   //! Returns the parametric value of the end point of
112   //! the current arc of curve.
113     Standard_Real LastParameter() const;
114 
115   //! Returns the number of points required to do the
116   //! integration along the parameter of curve.
117   Standard_EXPORT Standard_Integer IntegrationOrder() const;
118 
119   //! Returns the point of parameter U and the first derivative
120   //! at this point of a boundary curve.
121     void D12d (const Standard_Real U, gp_Pnt2d& P, gp_Vec2d& V1) const;
122 
123   //! Loading the boundary arc. This arc is either a top, bottom,
124   //! left or right bound of a UV rectangle in which the
125   //! parameters of surface are defined.
126   //! If IsFirstParam is equal to Standard_True, the face is
127   //! initialized by either left of bottom bound. Otherwise it is
128   //! initialized by the top or right one.
129   //! If theIsoType is equal to GeomAbs_IsoU, the face is
130   //! initialized with either left or right bound. Otherwise -
131   //! with either top or bottom one.
132   Standard_EXPORT void Load (const Standard_Boolean IsFirstParam, const GeomAbs_IsoType theIsoType);
133 
134   //! Returns an array of U knots of the face. The first and last
135   //! elements of the array will be theUMin and theUMax. The
136   //! middle elements will be the U Knots of the face greater
137   //! then theUMin and lower then theUMax in increasing order.
138   //! If the face is not a BSpline, the array initialized with
139   //! theUMin and theUMax only.
140   Standard_EXPORT void GetUKnots (const Standard_Real theUMin, const Standard_Real theUMax, Handle(TColStd_HArray1OfReal)& theUKnots) const;
141 
142   //! Returns an array of combination of T knots of the arc and
143   //! V knots of the face. The first and last elements of the
144   //! array will be theTMin and theTMax. The middle elements will
145   //! be the Knots of the arc and the values of parameters of
146   //! arc on which the value points have V coordinates close to V
147   //! knots of face. All the parameter will be greater then
148   //! theTMin and lower then theTMax in increasing order.
149   //! If the face is not a BSpline, the array initialized with
150   //! theTMin and theTMax only.
151   Standard_EXPORT void GetTKnots (const Standard_Real theTMin, const Standard_Real theTMax, Handle(TColStd_HArray1OfReal)& theTKnots) const;
152 
153 
154 
155 
156 protected:
157 
158 
159 
160 
161 
162 private:
163 
164 
165 
166   BRepAdaptor_Surface mySurface;
167   Geom2dAdaptor_Curve myCurve;
168   Standard_Boolean mySReverse;
169   Standard_Boolean myIsUseSpan;
170 
171 
172 };
173 
174 
175 #include <BRepGProp_Face.lxx>
176 
177 
178 
179 
180 
181 #endif // _BRepGProp_Face_HeaderFile
182