Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-10 09:17:19

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