Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-10-29 09:20:58

0001 // Created on: 1994-10-13
0002 // Created by: Jean Yves LEBEY
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 _TopOpeBRep_EdgesIntersector_HeaderFile
0018 #define _TopOpeBRep_EdgesIntersector_HeaderFile
0019 
0020 #include <BRepAdaptor_Surface.hxx>
0021 #include <GeomAbs_SurfaceType.hxx>
0022 #include <Geom2dAdaptor_Curve.hxx>
0023 #include <Geom2dInt_GInter.hxx>
0024 #include <IntRes2d_Domain.hxx>
0025 #include <IntRes2d_IntersectionPoint.hxx>
0026 #include <NCollection_Sequence.hxx>
0027 #include <IntRes2d_IntersectionSegment.hxx>
0028 #include <TopAbs_Orientation.hxx>
0029 #include <TopoDS_Face.hxx>
0030 #include <TopOpeBRep_Point2d.hxx>
0031 #include <TopOpeBRep_P2Dstatus.hxx>
0032 #include <TopOpeBRepDS_Config.hxx>
0033 
0034 class Bnd_Box;
0035 class BRepAdaptor_Surface;
0036 class TCollection_AsciiString;
0037 class TopOpeBRep_Point2d;
0038 class IntRes2d_IntersectionSegment;
0039 class IntRes2d_IntersectionPoint;
0040 class TopOpeBRepDS_Transition;
0041 class gp_Pnt;
0042 
0043 //! Describes the intersection of two edges on the same surface
0044 class TopOpeBRep_EdgesIntersector
0045 {
0046 public:
0047   DEFINE_STANDARD_ALLOC
0048 
0049   Standard_EXPORT TopOpeBRep_EdgesIntersector();
0050 
0051   Standard_EXPORT virtual ~TopOpeBRep_EdgesIntersector();
0052 
0053   Standard_EXPORT void SetFaces(const TopoDS_Shape& F1, const TopoDS_Shape& F2);
0054 
0055   Standard_EXPORT void SetFaces(const TopoDS_Shape& F1,
0056                                 const TopoDS_Shape& F2,
0057                                 const Bnd_Box&      B1,
0058                                 const Bnd_Box&      B2);
0059 
0060   Standard_EXPORT void ForceTolerances(const double Tol1, const double Tol2);
0061 
0062   Standard_EXPORT void Dimension(const int D);
0063 
0064   //! set working space dimension D = 1 for E &|| W, 2 for E in F
0065   Standard_EXPORT int Dimension() const;
0066 
0067   Standard_EXPORT void Perform(const TopoDS_Shape& E1,
0068                                const TopoDS_Shape& E2,
0069                                const bool          ReduceSegments = true);
0070 
0071   Standard_EXPORT bool IsEmpty();
0072 
0073   //! true if at least one intersection segment.
0074   Standard_EXPORT bool HasSegment() const;
0075 
0076   //! = mySameDomain.
0077   Standard_EXPORT bool SameDomain() const;
0078 
0079   Standard_EXPORT const TopoDS_Shape& Edge(const int Index) const;
0080 
0081   Standard_EXPORT const Geom2dAdaptor_Curve& Curve(const int Index) const;
0082 
0083   Standard_EXPORT const TopoDS_Shape& Face(const int Index) const;
0084 
0085   Standard_EXPORT const BRepAdaptor_Surface& Surface(const int Index) const;
0086 
0087   Standard_EXPORT bool SurfacesSameOriented() const;
0088 
0089   Standard_EXPORT bool FacesSameOriented() const;
0090 
0091   Standard_EXPORT double ToleranceMax() const;
0092 
0093   Standard_EXPORT void Tolerances(double& tol1, double& tol2) const;
0094 
0095   Standard_EXPORT int NbPoints() const;
0096 
0097   Standard_EXPORT int NbSegments() const;
0098 
0099   Standard_EXPORT void Dump(const TCollection_AsciiString& str,
0100                             const int                      ie1 = 0,
0101                             const int                      ie2 = 0);
0102 
0103   Standard_EXPORT void InitPoint(const bool selectkeep = true);
0104 
0105   Standard_EXPORT bool MorePoint() const;
0106 
0107   Standard_EXPORT void NextPoint();
0108 
0109   Standard_EXPORT const NCollection_Sequence<TopOpeBRep_Point2d>& Points() const;
0110 
0111   Standard_EXPORT const TopOpeBRep_Point2d& Point() const;
0112 
0113   Standard_EXPORT const TopOpeBRep_Point2d& Point(const int I) const;
0114 
0115   Standard_EXPORT virtual bool ReduceSegment(TopOpeBRep_Point2d& P1,
0116                                              TopOpeBRep_Point2d& P2,
0117                                              TopOpeBRep_Point2d& Pn) const;
0118 
0119   Standard_EXPORT TopOpeBRep_P2Dstatus Status1() const;
0120 
0121 private:
0122   Standard_EXPORT void Find();
0123 
0124   //! process if current edges can be considered as SameDomain
0125   Standard_EXPORT bool ComputeSameDomain();
0126 
0127   //! set field mySameDomain to B and return B value
0128   Standard_EXPORT bool SetSameDomain(const bool B);
0129 
0130   Standard_EXPORT void MakePoints2d();
0131 
0132   Standard_EXPORT void ReduceSegments();
0133 
0134   Standard_EXPORT const IntRes2d_IntersectionSegment& Segment1() const;
0135 
0136   Standard_EXPORT bool IsOpposite1() const;
0137 
0138   Standard_EXPORT void InitPoint1();
0139 
0140   Standard_EXPORT bool MorePoint1() const;
0141 
0142   Standard_EXPORT void NextPoint1();
0143 
0144   Standard_EXPORT const IntRes2d_IntersectionPoint& Point1() const;
0145 
0146   Standard_EXPORT TopOpeBRepDS_Transition Transition1(const int                Index,
0147                                                       const TopAbs_Orientation EO) const;
0148 
0149   Standard_EXPORT double Parameter1(const int Index) const;
0150 
0151   Standard_EXPORT bool IsVertex1(const int Index);
0152 
0153   Standard_EXPORT const TopoDS_Shape& Vertex1(const int Index);
0154 
0155   Standard_EXPORT gp_Pnt Value1() const;
0156 
0157   Standard_EXPORT bool IsPointOfSegment1() const;
0158 
0159   Standard_EXPORT int Index1() const;
0160 
0161   //! geometric configuration of E1,E2 at current intersection point :
0162   //! UNSHGEOMETRY if the edges do not share geometry.
0163   //! SAMEORIENTED if the edges share geometry and are same oriented.
0164   //! DIFFORIENTED if the edges share geometry and are not same oriented.
0165   Standard_EXPORT TopOpeBRepDS_Config EdgesConfig1() const;
0166 
0167   TopoDS_Face                                        myFace1;
0168   TopoDS_Face                                        myFace2;
0169   occ::handle<BRepAdaptor_Surface>                   mySurface1;
0170   occ::handle<BRepAdaptor_Surface>                   mySurface2;
0171   GeomAbs_SurfaceType                                mySurfaceType1;
0172   GeomAbs_SurfaceType                                mySurfaceType2;
0173   bool                                               mySurfacesSameOriented;
0174   bool                                               myFacesSameOriented;
0175   IntRes2d_Domain                                    myDomain1;
0176   IntRes2d_Domain                                    myDomain2;
0177   TopoDS_Edge                                        myEdge1;
0178   TopoDS_Edge                                        myEdge2;
0179   Geom2dAdaptor_Curve                                myCurve1;
0180   Geom2dAdaptor_Curve                                myCurve2;
0181   double                                             myTol1;
0182   double                                             myTol2;
0183   bool                                               myTolForced;
0184   Geom2dInt_GInter                                   myIntersector;
0185   NCollection_Sequence<IntRes2d_IntersectionPoint>   mylpnt;
0186   NCollection_Sequence<IntRes2d_IntersectionSegment> mylseg;
0187   int                                                myNbPoints;
0188   int                                                myNbSegments;
0189   int                                                myTrueNbPoints;
0190   int                                                myPointIndex;
0191   int                                                myIsVertexPointIndex;
0192   int                                                myIsVertexIndex;
0193   bool                                               myIsVertexValue;
0194   TopoDS_Vertex                                      myIsVertexVertex;
0195   int                                                myDimension;
0196   bool                                               myHasSegment;
0197   bool                                               mySameDomain;
0198   bool                                               myf1surf1F_sameoriented;
0199   bool                                               myf2surf1F_sameoriented;
0200   NCollection_Sequence<TopOpeBRep_Point2d>           mysp2d;
0201   int                                                myip2d;
0202   int                                                mynp2d;
0203   bool                                               myselectkeep;
0204 };
0205 
0206 #endif // _TopOpeBRep_EdgesIntersector_HeaderFile