Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-18 09:22:14

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_FaceEdgeIntersector_HeaderFile
0018 #define _TopOpeBRep_FaceEdgeIntersector_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 
0023 #include <TopoDS_Face.hxx>
0024 #include <TopoDS_Edge.hxx>
0025 #include <GeomAdaptor_Curve.hxx>
0026 #include <IntCurveSurface_IntersectionPoint.hxx>
0027 #include <NCollection_Sequence.hxx>
0028 #include <Standard_Integer.hxx>
0029 #include <TopExp_Explorer.hxx>
0030 #include <TopoDS_Shape.hxx>
0031 #include <TopoDS_Vertex.hxx>
0032 #include <TopAbs_State.hxx>
0033 #include <TopAbs_Orientation.hxx>
0034 #include <TopAbs_ShapeEnum.hxx>
0035 class gp_Pnt;
0036 class gp_Pnt2d;
0037 class TopOpeBRepDS_Transition;
0038 
0039 //! Describes the intersection of a face and an edge.
0040 class TopOpeBRep_FaceEdgeIntersector
0041 {
0042 public:
0043   DEFINE_STANDARD_ALLOC
0044 
0045   Standard_EXPORT TopOpeBRep_FaceEdgeIntersector();
0046 
0047   Standard_EXPORT void Perform(const TopoDS_Shape& F, const TopoDS_Shape& E);
0048 
0049   Standard_EXPORT bool IsEmpty();
0050 
0051   //! returns intersected face or edge according to
0052   //! value of <Index> = 1 or 2
0053   Standard_EXPORT const TopoDS_Shape& Shape(const int Index) const;
0054 
0055   //! Force the tolerance values used by the next Perform(S1,S2) call.
0056   Standard_EXPORT void ForceTolerance(const double tol);
0057 
0058   //! Return the tolerance value used in the last Perform() call
0059   //! If ForceTolerance() has been called, return the given value.
0060   //! If not, return value extracted from shapes.
0061   Standard_EXPORT double Tolerance() const;
0062 
0063   Standard_EXPORT int NbPoints() const;
0064 
0065   Standard_EXPORT void InitPoint();
0066 
0067   Standard_EXPORT bool MorePoint() const;
0068 
0069   Standard_EXPORT void NextPoint();
0070 
0071   //! return the 3D point of the current intersection point.
0072   Standard_EXPORT gp_Pnt Value() const;
0073 
0074   //! parametre de Value() sur l'arete
0075   Standard_EXPORT double Parameter() const;
0076 
0077   //! parametre de Value() sur la face
0078   Standard_EXPORT void UVPoint(gp_Pnt2d& P) const;
0079 
0080   //! IN ou ON / a la face. Les points OUT ne sont pas retournes.
0081   Standard_EXPORT TopAbs_State State() const;
0082 
0083   //! Index = 1 transition par rapport a la face, en cheminant sur l'arete
0084   Standard_EXPORT TopOpeBRepDS_Transition
0085     Transition(const int Index, const TopAbs_Orientation FaceOrientation) const;
0086 
0087   Standard_EXPORT bool IsVertex(const TopoDS_Shape& S,
0088                                 const gp_Pnt&       P,
0089                                 const double        Tol,
0090                                 TopoDS_Vertex&      V);
0091 
0092   Standard_EXPORT bool IsVertex(const int I, TopoDS_Vertex& V);
0093 
0094   //! trace only
0095   Standard_EXPORT int Index() const;
0096 
0097 private:
0098   Standard_EXPORT void ResetIntersection();
0099 
0100   //! extract tolerance values from shapes <S1>,<S2>,
0101   //! in order to perform intersection between <S1> and <S2>
0102   //! with tolerance values "fitting" the shape tolerances.
0103   //! (called by Perform() by default, when ForceTolerances() has not
0104   //! been called)
0105   Standard_EXPORT void ShapeTolerances(const TopoDS_Shape& S1, const TopoDS_Shape& S2);
0106 
0107   //! returns the max tolerance of sub-shapes of type <T>
0108   //! found in shape <S>. If no such sub-shape found, return
0109   //! Precision::Intersection()
0110   //! (called by ShapeTolerances())
0111   Standard_EXPORT double ToleranceMax(const TopoDS_Shape& S, const TopAbs_ShapeEnum T) const;
0112 
0113   TopoDS_Face                                             myFace;
0114   TopoDS_Edge                                             myEdge;
0115   double                                                  myTol;
0116   bool                                                    myForceTolerance;
0117   GeomAdaptor_Curve                                       myCurve;
0118   bool                                                    myIntersectionDone;
0119   NCollection_Sequence<IntCurveSurface_IntersectionPoint> mySequenceOfPnt;
0120   NCollection_Sequence<int>                               mySequenceOfState;
0121   int                                                     myPointIndex;
0122   int                                                     myNbPoints;
0123   TopExp_Explorer                                         myVertexExplorer;
0124   TopoDS_Shape                                            myNullShape;
0125   TopoDS_Vertex                                           myNullVertex;
0126 };
0127 
0128 #endif // _TopOpeBRep_FaceEdgeIntersector_HeaderFile