Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:04:09

0001 // Created on: 1993-01-21
0002 // Created by: Jacques GOUSSARD
0003 // Copyright (c) 1993-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 _IntPatch_Intersection_HeaderFile
0018 #define _IntPatch_Intersection_HeaderFile
0019 
0020 #include <Adaptor3d_Surface.hxx>
0021 #include <IntPatch_SequenceOfPoint.hxx>
0022 #include <IntPatch_SequenceOfLine.hxx>
0023 #include <IntSurf_ListOfPntOn2S.hxx>
0024 #include <GeomAbs_SurfaceType.hxx>
0025 #include <NCollection_Vector.hxx>
0026 
0027 class Adaptor3d_TopolTool;
0028 
0029 
0030 //! This class provides a generic algorithm to intersect
0031 //! 2 surfaces.
0032 class IntPatch_Intersection 
0033 {
0034 public:
0035 
0036   DEFINE_STANDARD_ALLOC
0037 
0038   
0039   Standard_EXPORT IntPatch_Intersection();
0040   
0041   Standard_EXPORT IntPatch_Intersection(const Handle(Adaptor3d_Surface)& S1, const Handle(Adaptor3d_TopolTool)& D1, const Handle(Adaptor3d_Surface)& S2, const Handle(Adaptor3d_TopolTool)& D2, const Standard_Real TolArc, const Standard_Real TolTang);
0042   
0043   Standard_EXPORT IntPatch_Intersection(const Handle(Adaptor3d_Surface)& S1, const Handle(Adaptor3d_TopolTool)& D1, const Standard_Real TolArc, const Standard_Real TolTang);
0044   
0045   //! Set the tolerances used by the algorithms:
0046   //! --- Implicit   - Parametric
0047   //! --- Parametric - Parametric
0048   //! --- Implicit   - Implicit
0049   //!
0050   //! TolArc   is  used  to   compute  the intersections
0051   //! between the restrictions   of  a  surface   and  a
0052   //! walking line.
0053   //!
0054   //! TolTang is used to compute the points on a walking
0055   //! line, and in geometric algorithms.
0056   //!
0057   //! Fleche  is  a  parameter   used in    the  walking
0058   //! algorithms to provide small curvatures on a line.
0059   //!
0060   //! UVMaxStep is  a  parameter   used in  the  walking
0061   //! algorithms  to    compute the  distance between to
0062   //! points in their respective parametric spaces.
0063   Standard_EXPORT void SetTolerances (const Standard_Real TolArc, const Standard_Real TolTang, const Standard_Real UVMaxStep, const Standard_Real Fleche);
0064   
0065   //! Flag theIsReqToKeepRLine has been entered only for
0066   //! compatibility with TopOpeBRep package. It shall be deleted
0067   //! after deleting TopOpeBRep.
0068   //! When intersection result returns IntPatch_RLine and another
0069   //! IntPatch_Line (not restriction) we (in case of theIsReqToKeepRLine==TRUE)
0070   //! will always keep both lines even if they are coincided.
0071   //! Flag theIsReqToPostWLProc has been entered only for
0072   //! compatibility with TopOpeBRep package. It shall be deleted
0073   //! after deleting TopOpeBRep.
0074   //! If theIsReqToPostWLProc == FALSE, then we will work with Walking-line
0075   //! obtained after intersection algorithm directly (without any post-processing).
0076   Standard_EXPORT void Perform (const Handle(Adaptor3d_Surface)& S1, const Handle(Adaptor3d_TopolTool)& D1, const Handle(Adaptor3d_Surface)& S2, const Handle(Adaptor3d_TopolTool)& D2, const Standard_Real TolArc, const Standard_Real TolTang, const Standard_Boolean isGeomInt = Standard_True, const Standard_Boolean theIsReqToKeepRLine = Standard_False, const Standard_Boolean theIsReqToPostWLProc = Standard_True);
0077   
0078   //! If isGeomInt == Standard_False, then method
0079   //! Param-Param intersection will be used.
0080   //! Flag theIsReqToKeepRLine has been entered only for
0081   //! compatibility with TopOpeBRep package. It shall be deleted
0082   //! after deleting TopOpeBRep.
0083   //! When intersection result returns IntPatch_RLine and another
0084   //! IntPatch_Line (not restriction) we (in case of theIsReqToKeepRLine==TRUE)
0085   //! will always keep both lines even if they are coincided.
0086   //! Flag theIsReqToPostWLProc has been entered only for
0087   //! compatibility with TopOpeBRep package. It shall be deleted
0088   //! after deleting TopOpeBRep.
0089   //! If theIsReqToPostWLProc == FALSE, then we will work with Walking-line
0090   //! obtained after intersection algorithm directly (without any post-processing). 
0091   Standard_EXPORT void Perform (const Handle(Adaptor3d_Surface)& S1, const Handle(Adaptor3d_TopolTool)& D1, const Handle(Adaptor3d_Surface)& S2, const Handle(Adaptor3d_TopolTool)& D2, const Standard_Real TolArc, const Standard_Real TolTang, IntSurf_ListOfPntOn2S& LOfPnts, const Standard_Boolean isGeomInt = Standard_True, const Standard_Boolean theIsReqToKeepRLine = Standard_False, const Standard_Boolean theIsReqToPostWLProc = Standard_True);
0092   
0093   //! Perform with start point
0094   Standard_EXPORT void Perform (const Handle(Adaptor3d_Surface)& S1, const Handle(Adaptor3d_TopolTool)& D1, const Handle(Adaptor3d_Surface)& S2, const Handle(Adaptor3d_TopolTool)& D2, const Standard_Real U1, const Standard_Real V1, const Standard_Real U2, const Standard_Real V2, const Standard_Real TolArc, const Standard_Real TolTang);
0095   
0096   //! Uses for finding self-intersected surfaces.
0097   Standard_EXPORT void Perform (const Handle(Adaptor3d_Surface)& S1, const Handle(Adaptor3d_TopolTool)& D1, const Standard_Real TolArc, const Standard_Real TolTang);
0098   
0099   //! Returns True if the calculus was successful.
0100     Standard_Boolean IsDone() const;
0101   
0102   //! Returns true if the is no intersection.
0103     Standard_Boolean IsEmpty() const;
0104   
0105   //! Returns True if the two patches are considered as
0106   //! entirely tangent, i-e every restriction arc of one
0107   //! patch is inside the geometric base of the other patch.
0108     Standard_Boolean TangentFaces() const;
0109   
0110   //! Returns True when the TangentFaces returns True and the
0111   //! normal vectors evaluated at a point on the first and the
0112   //! second surface are opposite.
0113   //! The exception DomainError is raised if TangentFaces
0114   //! returns False.
0115     Standard_Boolean OppositeFaces() const;
0116   
0117   //! Returns the number of "single" points.
0118     Standard_Integer NbPnts() const;
0119   
0120   //! Returns the point of range Index.
0121   //! An exception is raised if Index<=0 or Index>NbPnt.
0122     const IntPatch_Point& Point (const Standard_Integer Index) const;
0123   
0124   //! Returns the number of intersection lines.
0125     Standard_Integer NbLines() const;
0126   
0127   //! Returns the line of range Index.
0128   //! An exception is raised if Index<=0 or Index>NbLine.
0129     const Handle(IntPatch_Line)& Line (const Standard_Integer Index) const;
0130   
0131   Standard_EXPORT const IntPatch_SequenceOfLine& SequenceOfLine() const;
0132   
0133   //! Dump of each result line.
0134   //! Mode for more accurate dumps.
0135   Standard_EXPORT void Dump (const Standard_Integer Mode, const Handle(Adaptor3d_Surface)& S1, const Handle(Adaptor3d_TopolTool)& D1, const Handle(Adaptor3d_Surface)& S2, const Handle(Adaptor3d_TopolTool)& D2) const;
0136 
0137   //! Checks if surface theS1 has degenerated boundary (dS/du or dS/dv = 0) and
0138   //! calculates minimal distance between corresponding singular points and surface theS2
0139   //! If singular point exists the method returns "true" and stores minimal distance in theDist.
0140   Standard_EXPORT static Standard_Boolean CheckSingularPoints(
0141     const Handle(Adaptor3d_Surface)&  theS1,
0142     const Handle(Adaptor3d_TopolTool)& theD1,
0143     const Handle(Adaptor3d_Surface)&  theS2,
0144     Standard_Real& theDist);
0145 
0146   //! Calculates recommended value for myUVMaxStep depending on surfaces and their domains
0147   Standard_EXPORT static Standard_Real DefineUVMaxStep(
0148     const Handle(Adaptor3d_Surface)&  theS1,
0149     const Handle(Adaptor3d_TopolTool)& theD1,
0150     const Handle(Adaptor3d_Surface)&  theS2,
0151     const Handle(Adaptor3d_TopolTool)& theD2);
0152 
0153   //! Prepares surfaces for intersection
0154   Standard_EXPORT static void PrepareSurfaces(
0155       const Handle(Adaptor3d_Surface)& theS1,
0156       const Handle(Adaptor3d_TopolTool)& theD1,
0157       const Handle(Adaptor3d_Surface)& theS2,
0158       const Handle(Adaptor3d_TopolTool)& theD2,
0159       const Standard_Real Tol,
0160       NCollection_Vector< Handle(Adaptor3d_Surface)>& theSeqHS1,
0161       NCollection_Vector< Handle(Adaptor3d_Surface)>& theSeqHS2);
0162 
0163 protected:
0164 
0165 
0166 
0167 
0168 
0169 private:
0170 
0171   
0172   Standard_EXPORT void ParamParamPerfom (const Handle(Adaptor3d_Surface)& S1, const Handle(Adaptor3d_TopolTool)& D1, const Handle(Adaptor3d_Surface)& S2, const Handle(Adaptor3d_TopolTool)& D2, const Standard_Real TolArc, const Standard_Real TolTang, IntSurf_ListOfPntOn2S& LOfPnts, const GeomAbs_SurfaceType typs1, const GeomAbs_SurfaceType typs2);
0173   
0174   //! Flag theIsReqToKeepRLine has been entered only for
0175   //! compatibility with TopOpeBRep package. It shall be deleted
0176   //! after deleting TopOpeBRep.
0177   //! When intersection result returns IntPatch_RLine and another
0178   //! IntPatch_Line (not restriction) we (in case of theIsReqToKeepRLine==TRUE)
0179   //! will always keep both lines even if they are coincided.
0180   Standard_EXPORT void GeomGeomPerfom (const Handle(Adaptor3d_Surface)& S1, const Handle(Adaptor3d_TopolTool)& D1, const Handle(Adaptor3d_Surface)& S2, const Handle(Adaptor3d_TopolTool)& D2, const Standard_Real TolArc, const Standard_Real TolTang, IntSurf_ListOfPntOn2S& LOfPnts, const GeomAbs_SurfaceType typs1, const GeomAbs_SurfaceType typs2, const Standard_Boolean theIsReqToKeepRLine);
0181   
0182   Standard_EXPORT void GeomParamPerfom (const Handle(Adaptor3d_Surface)& S1, const Handle(Adaptor3d_TopolTool)& D1, const Handle(Adaptor3d_Surface)& S2, const Handle(Adaptor3d_TopolTool)& D2, const Standard_Boolean isNotAnalitical, const GeomAbs_SurfaceType typs1, const GeomAbs_SurfaceType typs2);
0183 
0184 
0185   Standard_Boolean done;
0186   Standard_Boolean empt;
0187   Standard_Boolean tgte;
0188   Standard_Boolean oppo;
0189   IntPatch_SequenceOfPoint spnt;
0190   IntPatch_SequenceOfLine slin;
0191   Standard_Real myTolArc;
0192   Standard_Real myTolTang;
0193   Standard_Real myUVMaxStep;
0194   Standard_Real myFleche;
0195   Standard_Boolean myIsStartPnt;
0196   Standard_Real myU1Start;
0197   Standard_Real myV1Start;
0198   Standard_Real myU2Start;
0199   Standard_Real myV2Start;
0200 
0201 
0202 };
0203 
0204 
0205 #include <IntPatch_Intersection.lxx>
0206 
0207 
0208 
0209 
0210 
0211 #endif // _IntPatch_Intersection_HeaderFile