Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-02 08:23:47

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_SequenceOfIntersectionPoint.hxx>
0026 #include <IntRes2d_SequenceOfIntersectionSegment.hxx>
0027 #include <TopAbs_Orientation.hxx>
0028 #include <TopoDS_Face.hxx>
0029 #include <TopOpeBRep_SequenceOfPoint2d.hxx>
0030 #include <TopOpeBRep_P2Dstatus.hxx>
0031 #include <TopOpeBRepDS_Config.hxx>
0032 
0033 class Bnd_Box;
0034 class BRepAdaptor_Surface;
0035 class TCollection_AsciiString;
0036 class TopOpeBRep_Point2d;
0037 class IntRes2d_IntersectionSegment;
0038 class IntRes2d_IntersectionPoint;
0039 class TopOpeBRepDS_Transition;
0040 class gp_Pnt;
0041 
0042 //! Describes the intersection of two edges on the same surface
0043 class TopOpeBRep_EdgesIntersector
0044 {
0045 public:
0046   DEFINE_STANDARD_ALLOC
0047 
0048   Standard_EXPORT TopOpeBRep_EdgesIntersector();
0049 
0050   Standard_EXPORT virtual ~TopOpeBRep_EdgesIntersector();
0051 
0052   Standard_EXPORT void SetFaces(const TopoDS_Shape& F1, const TopoDS_Shape& F2);
0053 
0054   Standard_EXPORT void SetFaces(const TopoDS_Shape& F1,
0055                                 const TopoDS_Shape& F2,
0056                                 const Bnd_Box&      B1,
0057                                 const Bnd_Box&      B2);
0058 
0059   Standard_EXPORT void ForceTolerances(const Standard_Real Tol1, const Standard_Real Tol2);
0060 
0061   Standard_EXPORT void Dimension(const Standard_Integer D);
0062 
0063   //! set working space dimension D = 1 for E &|| W, 2 for E in F
0064   Standard_EXPORT Standard_Integer Dimension() const;
0065 
0066   Standard_EXPORT void Perform(const TopoDS_Shape&    E1,
0067                                const TopoDS_Shape&    E2,
0068                                const Standard_Boolean ReduceSegments = Standard_True);
0069 
0070   Standard_EXPORT Standard_Boolean IsEmpty();
0071 
0072   //! true if at least one intersection segment.
0073   Standard_EXPORT Standard_Boolean HasSegment() const;
0074 
0075   //! = mySameDomain.
0076   Standard_EXPORT Standard_Boolean SameDomain() const;
0077 
0078   Standard_EXPORT const TopoDS_Shape& Edge(const Standard_Integer Index) const;
0079 
0080   Standard_EXPORT const Geom2dAdaptor_Curve& Curve(const Standard_Integer Index) const;
0081 
0082   Standard_EXPORT const TopoDS_Shape& Face(const Standard_Integer Index) const;
0083 
0084   Standard_EXPORT const BRepAdaptor_Surface& Surface(const Standard_Integer Index) const;
0085 
0086   Standard_EXPORT Standard_Boolean SurfacesSameOriented() const;
0087 
0088   Standard_EXPORT Standard_Boolean FacesSameOriented() const;
0089 
0090   Standard_EXPORT Standard_Real ToleranceMax() const;
0091 
0092   Standard_EXPORT void Tolerances(Standard_Real& tol1, Standard_Real& tol2) const;
0093 
0094   Standard_EXPORT Standard_Integer NbPoints() const;
0095 
0096   Standard_EXPORT Standard_Integer NbSegments() const;
0097 
0098   Standard_EXPORT void Dump(const TCollection_AsciiString& str,
0099                             const Standard_Integer         ie1 = 0,
0100                             const Standard_Integer         ie2 = 0);
0101 
0102   Standard_EXPORT void InitPoint(const Standard_Boolean selectkeep = Standard_True);
0103 
0104   Standard_EXPORT Standard_Boolean MorePoint() const;
0105 
0106   Standard_EXPORT void NextPoint();
0107 
0108   Standard_EXPORT const TopOpeBRep_SequenceOfPoint2d& Points() const;
0109 
0110   Standard_EXPORT const TopOpeBRep_Point2d& Point() const;
0111 
0112   Standard_EXPORT const TopOpeBRep_Point2d& Point(const Standard_Integer I) const;
0113 
0114   Standard_EXPORT virtual Standard_Boolean ReduceSegment(TopOpeBRep_Point2d& P1,
0115                                                          TopOpeBRep_Point2d& P2,
0116                                                          TopOpeBRep_Point2d& Pn) const;
0117 
0118   Standard_EXPORT TopOpeBRep_P2Dstatus Status1() const;
0119 
0120 protected:
0121 private:
0122   Standard_EXPORT void Find();
0123 
0124   //! process if current edges can be considered as SameDomain
0125   Standard_EXPORT Standard_Boolean ComputeSameDomain();
0126 
0127   //! set field mySameDomain to B and return B value
0128   Standard_EXPORT Standard_Boolean SetSameDomain(const Standard_Boolean 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 Standard_Boolean IsOpposite1() const;
0137 
0138   Standard_EXPORT void InitPoint1();
0139 
0140   Standard_EXPORT Standard_Boolean 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 Standard_Integer   Index,
0147                                                       const TopAbs_Orientation EO) const;
0148 
0149   Standard_EXPORT Standard_Real Parameter1(const Standard_Integer Index) const;
0150 
0151   Standard_EXPORT Standard_Boolean IsVertex1(const Standard_Integer Index);
0152 
0153   Standard_EXPORT const TopoDS_Shape& Vertex1(const Standard_Integer Index);
0154 
0155   Standard_EXPORT gp_Pnt Value1() const;
0156 
0157   Standard_EXPORT Standard_Boolean IsPointOfSegment1() const;
0158 
0159   Standard_EXPORT Standard_Integer 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   Handle(BRepAdaptor_Surface)            mySurface1;
0170   Handle(BRepAdaptor_Surface)            mySurface2;
0171   GeomAbs_SurfaceType                    mySurfaceType1;
0172   GeomAbs_SurfaceType                    mySurfaceType2;
0173   Standard_Boolean                       mySurfacesSameOriented;
0174   Standard_Boolean                       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   Standard_Real                          myTol1;
0182   Standard_Real                          myTol2;
0183   Standard_Boolean                       myTolForced;
0184   Geom2dInt_GInter                       myIntersector;
0185   IntRes2d_SequenceOfIntersectionPoint   mylpnt;
0186   IntRes2d_SequenceOfIntersectionSegment mylseg;
0187   Standard_Integer                       myNbPoints;
0188   Standard_Integer                       myNbSegments;
0189   Standard_Integer                       myTrueNbPoints;
0190   Standard_Integer                       myPointIndex;
0191   Standard_Integer                       myIsVertexPointIndex;
0192   Standard_Integer                       myIsVertexIndex;
0193   Standard_Boolean                       myIsVertexValue;
0194   TopoDS_Vertex                          myIsVertexVertex;
0195   Standard_Integer                       myDimension;
0196   Standard_Boolean                       myHasSegment;
0197   Standard_Boolean                       mySameDomain;
0198   Standard_Boolean                       myf1surf1F_sameoriented;
0199   Standard_Boolean                       myf2surf1F_sameoriented;
0200   TopOpeBRep_SequenceOfPoint2d           mysp2d;
0201   Standard_Integer                       myip2d;
0202   Standard_Integer                       mynp2d;
0203   Standard_Boolean                       myselectkeep;
0204 };
0205 
0206 #endif // _TopOpeBRep_EdgesIntersector_HeaderFile