1 // Created on: 1994-03-24
3 // Copyright (c) 1994-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 _Adaptor3d_TopolTool_HeaderFile
18 #define _Adaptor3d_TopolTool_HeaderFile
20 #include <TColStd_HArray1OfReal.hxx>
21 #include <TopAbs_State.hxx>
22 #include <TopAbs_Orientation.hxx>
23 #include <TColStd_Array1OfReal.hxx>
24 #include <Adaptor3d_HVertex.hxx>
26 class Adaptor2d_HLine2d;
27 class Adaptor3d_HVertex;
28 class Adaptor3d_HSurface;
29 class Standard_DomainError;
30 class Adaptor2d_HCurve2d;
35 class Adaptor3d_TopolTool;
36 DEFINE_STANDARD_HANDLE(Adaptor3d_TopolTool, MMgt_TShared)
38 //! This class provides a default topological tool,
39 //! based on the Umin,Vmin,Umax,Vmax of an HSurface
41 //! All methods and fields may be redefined when
42 //! inheriting from this class.
43 //! This class is used to instantiate algorithmes
44 //! as Intersection, outlines,...
45 class Adaptor3d_TopolTool : public MMgt_TShared
51 Standard_EXPORT Adaptor3d_TopolTool();
53 Standard_EXPORT Adaptor3d_TopolTool(const Handle(Adaptor3d_HSurface)& Surface);
55 Standard_EXPORT virtual void Initialize();
57 Standard_EXPORT virtual void Initialize (const Handle(Adaptor3d_HSurface)& S);
59 Standard_EXPORT virtual void Initialize (const Handle(Adaptor2d_HCurve2d)& Curve);
61 Standard_EXPORT virtual void Init();
63 Standard_EXPORT virtual Standard_Boolean More();
65 Standard_EXPORT virtual Handle(Adaptor2d_HCurve2d) Value();
67 Standard_EXPORT virtual void Next();
69 Standard_EXPORT virtual void InitVertexIterator();
71 Standard_EXPORT virtual Standard_Boolean MoreVertex();
73 Standard_EXPORT virtual Handle(Adaptor3d_HVertex) Vertex();
75 Standard_EXPORT virtual void NextVertex();
77 Standard_EXPORT virtual TopAbs_State Classify (const gp_Pnt2d& P, const Standard_Real Tol, const Standard_Boolean ReacdreOnPeriodic = Standard_True);
79 Standard_EXPORT virtual Standard_Boolean IsThePointOn (const gp_Pnt2d& P, const Standard_Real Tol, const Standard_Boolean ReacdreOnPeriodic = Standard_True);
81 //! If the function returns the orientation of the arc.
82 //! If the orientation is FORWARD or REVERSED, the arc is
83 //! a "real" limit of the surface.
84 //! If the orientation is INTERNAL or EXTERNAL, the arc is
85 //! considered as an arc on the surface.
86 Standard_EXPORT virtual TopAbs_Orientation Orientation (const Handle(Adaptor2d_HCurve2d)& C);
88 //! Returns the orientation of the vertex V.
89 //! The vertex has been found with an exploration on
90 //! a given arc. The orientation is the orientation
91 //! of the vertex on this arc.
92 Standard_EXPORT virtual TopAbs_Orientation Orientation (const Handle(Adaptor3d_HVertex)& V);
94 //! Returns True if the vertices V1 and V2 are identical.
95 //! This method does not take the orientation of the
96 //! vertices in account.
97 Standard_EXPORT virtual Standard_Boolean Identical (const Handle(Adaptor3d_HVertex)& V1, const Handle(Adaptor3d_HVertex)& V2);
99 //! answers if arcs and vertices may have 3d representations,
100 //! so that we could use Tol3d and Pnt methods.
101 Standard_EXPORT virtual Standard_Boolean Has3d() const;
103 //! returns 3d tolerance of the arc C
104 Standard_EXPORT virtual Standard_Real Tol3d (const Handle(Adaptor2d_HCurve2d)& C) const;
106 //! returns 3d tolerance of the vertex V
107 Standard_EXPORT virtual Standard_Real Tol3d (const Handle(Adaptor3d_HVertex)& V) const;
109 //! returns 3d point of the vertex V
110 Standard_EXPORT virtual gp_Pnt Pnt (const Handle(Adaptor3d_HVertex)& V) const;
112 Standard_EXPORT virtual void ComputeSamplePoints();
114 //! compute the sample-points for the intersections algorithms
115 Standard_EXPORT virtual Standard_Integer NbSamplesU();
117 //! compute the sample-points for the intersections algorithms
118 Standard_EXPORT virtual Standard_Integer NbSamplesV();
120 //! compute the sample-points for the intersections algorithms
121 Standard_EXPORT virtual Standard_Integer NbSamples();
123 //! return the set of U parameters on the surface
124 //! obtained by the method SamplePnts
125 Standard_EXPORT void UParameters (TColStd_Array1OfReal& theArray) const;
127 //! return the set of V parameters on the surface
128 //! obtained by the method SamplePnts
129 Standard_EXPORT void VParameters (TColStd_Array1OfReal& theArray) const;
131 Standard_EXPORT virtual void SamplePoint (const Standard_Integer Index, gp_Pnt2d& P2d, gp_Pnt& P3d);
133 Standard_EXPORT virtual Standard_Boolean DomainIsInfinite();
135 Standard_EXPORT virtual Standard_Address Edge() const;
137 //! compute the sample-points for the intersections algorithms
138 //! by adaptive algorithm for BSpline surfaces. For other surfaces algorithm
139 //! is the same as in method ComputeSamplePoints(), but only fill arrays of U
140 //! and V sample parameters;
141 //! theDefl is a requred deflection
142 //! theNUmin, theNVmin are minimal nb points for U and V.
143 Standard_EXPORT virtual void SamplePnts (const Standard_Real theDefl, const Standard_Integer theNUmin, const Standard_Integer theNVmin);
145 //! compute the sample-points for the intersections algorithms
146 //! by adaptive algorithm for BSpline surfaces - is used in SamplePnts
147 //! theDefl is a requred deflection
148 //! theNUmin, theNVmin are minimal nb points for U and V.
149 Standard_EXPORT virtual void BSplSamplePnts (const Standard_Real theDefl, const Standard_Integer theNUmin, const Standard_Integer theNVmin);
151 //! Returns true if provide uniform sampling of points.
152 Standard_EXPORT virtual Standard_Boolean IsUniformSampling() const;
157 DEFINE_STANDARD_RTTIEXT(Adaptor3d_TopolTool,MMgt_TShared)
162 Handle(Adaptor3d_HSurface) myS;
163 Standard_Integer myNbSamplesU;
164 Standard_Integer myNbSamplesV;
165 Handle(TColStd_HArray1OfReal) myUPars;
166 Handle(TColStd_HArray1OfReal) myVPars;
172 Standard_Integer nbRestr;
173 Standard_Integer idRestr;
178 Handle(Adaptor2d_HLine2d) myRestr[4];
179 Standard_Integer nbVtx;
180 Standard_Integer idVtx;
181 Handle(Adaptor3d_HVertex) myVtx[2];
192 #endif // _Adaptor3d_TopolTool_HeaderFile