1a250db71f3c4e4037a93534ba6e883846584d49
[occt.git] / src / BRepMesh / BRepMesh_EdgeParameterProvider.hxx
1 // Created on: 2014-08-13
2 // Created by: Oleg AGASHIN
3 // Copyright (c) 2011-2014 OPEN CASCADE SAS
4 //
5 // This file is part of Open CASCADE Technology software library.
6 //
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License version 2.1 as published
9 // by the Free Software Foundation, with special exception defined in the file
10 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 // distribution for complete text of the license and disclaimer of any warranty.
12 //
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
15
16 #ifndef _BRepMesh_EdgeParameterProvider_HeaderFile
17 #define _BRepMesh_EdgeParameterProvider_HeaderFile
18
19 #include <Standard.hxx>
20 #include <Standard_DefineAlloc.hxx>
21 #include <Extrema_LocateExtPC.hxx>
22 #include <Handle_TColStd_HArray1OfReal.hxx>
23
24 class gp_Pnt;
25 class TopoDS_Edge;
26 class TopoDS_Face;
27 class TColStd_HArray1OfReal;
28
29 //! Auxiliary class provides correct parameters 
30 //! on curve regarding SameParameter flag.
31 class BRepMesh_EdgeParameterProvider
32 {
33 public:
34
35   DEFINE_STANDARD_ALLOC
36
37   //! Constructor.
38   //! @param theEdge edge which parameters should be processed.
39   //! @param theFace face the parametric values are defined for.
40   //! @param theParameters parameters corresponded to discretization points.
41   BRepMesh_EdgeParameterProvider(
42     const TopoDS_Edge&                   theEdge,
43     const TopoDS_Face&                   theFace,
44     const Handle(TColStd_HArray1OfReal)& theParameters);
45
46   //! Returns parameter according to SameParameter flag of the edge.
47   //! If SameParameter is TRUE returns value from parameters w/o changes,
48   //! elsewhere scales initial parameter and tries to determine resulting
49   //! value using projection of the corresponded 3D point on PCurve.
50   Standard_Real Parameter(const Standard_Integer theIndex,
51                           const gp_Pnt&          thePoint3d);
52
53 private:
54
55   Handle(TColStd_HArray1OfReal) myParameters;
56
57   Standard_Boolean              myIsSameParam;
58   Standard_Real                 myFirstParam;
59
60   Standard_Real                 myOldFirstParam;
61   Standard_Real                 myScale;
62
63   Standard_Real                 myCurParam;
64   Standard_Real                 myFoundParam;
65
66   Extrema_LocateExtPC           myProjector;
67 };
68
69 #endif