Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-19 09:26:59

0001 // Created on: 1994-03-24
0002 // Created by: model
0003 // Copyright (c) 1994-1999 Matra Datavision
0004 // Copyright (c) 1999-2014 OPEN CASCADE SAS
0005 //
0006 // This file is part of Open CASCADE Technology software library.
0007 //
0008 // This library is free software; you can redistribute it and/or modify it under
0009 // the terms of the GNU Lesser General Public License version 2.1 as published
0010 // by the Free Software Foundation, with special exception defined in the file
0011 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0012 // distribution for complete text of the license and disclaimer of any warranty.
0013 //
0014 // Alternatively, this file may be used under the terms of Open CASCADE
0015 // commercial license or contractual agreement.
0016 
0017 #ifndef _Adaptor3d_TopolTool_HeaderFile
0018 #define _Adaptor3d_TopolTool_HeaderFile
0019 
0020 #include <Adaptor2d_Line2d.hxx>
0021 #include <Adaptor3d_HVertex.hxx>
0022 #include <Adaptor3d_Surface.hxx>
0023 #include <NCollection_Array1.hxx>
0024 #include <NCollection_HArray1.hxx>
0025 #include <TopAbs_State.hxx>
0026 #include <TopAbs_Orientation.hxx>
0027 
0028 class Adaptor3d_HVertex;
0029 
0030 //! This class provides a default topological tool,
0031 //! based on the Umin,Vmin,Umax,Vmax of an HSurface from Adaptor3d.
0032 //! All methods and fields may be redefined when inheriting from this class.
0033 //! This class is used to instantiate algorithms as Intersection, outlines,...
0034 class Adaptor3d_TopolTool : public Standard_Transient
0035 {
0036 
0037 public:
0038   Standard_EXPORT Adaptor3d_TopolTool();
0039 
0040   Standard_EXPORT Adaptor3d_TopolTool(const occ::handle<Adaptor3d_Surface>& Surface);
0041 
0042   Standard_EXPORT virtual void Initialize();
0043 
0044   Standard_EXPORT virtual void Initialize(const occ::handle<Adaptor3d_Surface>& S);
0045 
0046   Standard_EXPORT virtual void Initialize(const occ::handle<Adaptor2d_Curve2d>& Curve);
0047 
0048   Standard_EXPORT virtual void Init();
0049 
0050   Standard_EXPORT virtual bool More();
0051 
0052   Standard_EXPORT virtual occ::handle<Adaptor2d_Curve2d> Value();
0053 
0054   Standard_EXPORT virtual void Next();
0055 
0056   Standard_EXPORT virtual void InitVertexIterator();
0057 
0058   Standard_EXPORT virtual bool MoreVertex();
0059 
0060   Standard_EXPORT virtual occ::handle<Adaptor3d_HVertex> Vertex();
0061 
0062   Standard_EXPORT virtual void NextVertex();
0063 
0064   Standard_EXPORT virtual TopAbs_State Classify(const gp_Pnt2d& P,
0065                                                 const double    Tol,
0066                                                 const bool      ReacdreOnPeriodic = true);
0067 
0068   Standard_EXPORT virtual bool IsThePointOn(const gp_Pnt2d& P,
0069                                             const double    Tol,
0070                                             const bool      ReacdreOnPeriodic = true);
0071 
0072   //! If the function returns the orientation of the arc.
0073   //! If the orientation is FORWARD or REVERSED, the arc is
0074   //! a "real" limit of the surface.
0075   //! If the orientation is INTERNAL or EXTERNAL, the arc is
0076   //! considered as an arc on the surface.
0077   Standard_EXPORT virtual TopAbs_Orientation Orientation(const occ::handle<Adaptor2d_Curve2d>& C);
0078 
0079   //! Returns the orientation of the vertex V.
0080   //! The vertex has been found with an exploration on
0081   //! a given arc. The orientation is the orientation
0082   //! of the vertex on this arc.
0083   Standard_EXPORT virtual TopAbs_Orientation Orientation(const occ::handle<Adaptor3d_HVertex>& V);
0084 
0085   //! Returns True if the vertices V1 and V2 are identical.
0086   //! This method does not take the orientation of the
0087   //! vertices in account.
0088   Standard_EXPORT virtual bool Identical(const occ::handle<Adaptor3d_HVertex>& V1,
0089                                          const occ::handle<Adaptor3d_HVertex>& V2);
0090 
0091   //! answers if arcs and vertices may have 3d representations,
0092   //! so that we could use Tol3d and Pnt methods.
0093   Standard_EXPORT virtual bool Has3d() const;
0094 
0095   //! returns 3d tolerance of the arc C
0096   Standard_EXPORT virtual double Tol3d(const occ::handle<Adaptor2d_Curve2d>& C) const;
0097 
0098   //! returns 3d tolerance of the vertex V
0099   Standard_EXPORT virtual double Tol3d(const occ::handle<Adaptor3d_HVertex>& V) const;
0100 
0101   //! returns 3d point of the vertex V
0102   Standard_EXPORT virtual gp_Pnt Pnt(const occ::handle<Adaptor3d_HVertex>& V) const;
0103 
0104   Standard_EXPORT virtual void ComputeSamplePoints();
0105 
0106   //! compute the sample-points for the intersections algorithms
0107   Standard_EXPORT virtual int NbSamplesU();
0108 
0109   //! compute the sample-points for the intersections algorithms
0110   Standard_EXPORT virtual int NbSamplesV();
0111 
0112   //! compute the sample-points for the intersections algorithms
0113   Standard_EXPORT virtual int NbSamples();
0114 
0115   //! return the set of U parameters on the surface
0116   //! obtained by the method SamplePnts
0117   Standard_EXPORT void UParameters(NCollection_Array1<double>& theArray) const;
0118 
0119   //! return the set of V parameters on the surface
0120   //! obtained by the method SamplePnts
0121   Standard_EXPORT void VParameters(NCollection_Array1<double>& theArray) const;
0122 
0123   Standard_EXPORT virtual void SamplePoint(const int Index, gp_Pnt2d& P2d, gp_Pnt& P3d);
0124 
0125   Standard_EXPORT virtual bool DomainIsInfinite();
0126 
0127   Standard_EXPORT virtual void* Edge() const;
0128 
0129   //! Compute the sample-points for the intersections algorithms by adaptive algorithm for BSpline
0130   //! surfaces. For other surfaces algorithm is the same as in method ComputeSamplePoints(), but
0131   //! only fill arrays of U and V sample parameters;
0132   //! @param[in] theDefl   a required deflection
0133   //! @param[in] theNUmin  minimal nb points for U
0134   //! @param[in] theNVmin  minimal nb points for V
0135   Standard_EXPORT virtual void SamplePnts(const double theDefl,
0136                                           const int    theNUmin,
0137                                           const int    theNVmin);
0138 
0139   //! Compute the sample-points for the intersections algorithms
0140   //! by adaptive algorithm for BSpline surfaces - is used in SamplePnts
0141   //! @param[in] theDefl   required deflection
0142   //! @param[in] theNUmin  minimal nb points for U
0143   //! @param[in] theNVmin  minimal nb points for V
0144   Standard_EXPORT virtual void BSplSamplePnts(const double theDefl,
0145                                               const int    theNUmin,
0146                                               const int    theNVmin);
0147 
0148   //! Returns true if provide uniform sampling of points.
0149   Standard_EXPORT virtual bool IsUniformSampling() const;
0150 
0151   //! Computes the cone's apex parameters.
0152   //! @param[in] theC conical surface
0153   //! @param[in] theU U parameter of cone's apex
0154   //! @param[in] theV V parameter of cone's apex
0155   Standard_EXPORT static void GetConeApexParam(const gp_Cone& theC, double& theU, double& theV);
0156 
0157   DEFINE_STANDARD_RTTIEXT(Adaptor3d_TopolTool, Standard_Transient)
0158 
0159 protected:
0160   occ::handle<Adaptor3d_Surface>           myS;
0161   int                                      myNbSamplesU;
0162   int                                      myNbSamplesV;
0163   occ::handle<NCollection_HArray1<double>> myUPars;
0164   occ::handle<NCollection_HArray1<double>> myVPars;
0165 
0166 private:
0167   int                            nbRestr;
0168   int                            idRestr;
0169   double                         Uinf;
0170   double                         Usup;
0171   double                         Vinf;
0172   double                         Vsup;
0173   occ::handle<Adaptor2d_Line2d>  myRestr[4];
0174   int                            nbVtx;
0175   int                            idVtx;
0176   occ::handle<Adaptor3d_HVertex> myVtx[2];
0177 };
0178 
0179 #endif // _Adaptor3d_TopolTool_HeaderFile