Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-14 09:15:00

0001 // Created on: 1998-01-27
0002 // Created by: Laurent BUCHARD
0003 // Copyright (c) 1998-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 _IntCurvesFace_ShapeIntersector_HeaderFile
0018 #define _IntCurvesFace_ShapeIntersector_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 #include <Standard_Handle.hxx>
0023 
0024 #include <Standard_Boolean.hxx>
0025 #include <Standard_Integer.hxx>
0026 #include <NCollection_Array1.hxx>
0027 #include <NCollection_Sequence.hxx>
0028 #include <Standard_Real.hxx>
0029 #include <IntCurveSurface_TransitionOnCurve.hxx>
0030 #include <IntCurvesFace_Intersector.hxx>
0031 #include <TopAbs_State.hxx>
0032 
0033 class Adaptor3d_Curve;
0034 class TopoDS_Shape;
0035 class gp_Lin;
0036 class gp_Pnt;
0037 class TopoDS_Face;
0038 
0039 class IntCurvesFace_ShapeIntersector
0040 {
0041 public:
0042   DEFINE_STANDARD_ALLOC
0043 
0044   Standard_EXPORT IntCurvesFace_ShapeIntersector();
0045 
0046   Standard_EXPORT void Load(const TopoDS_Shape& Sh, const double Tol);
0047 
0048   //! Perform the intersection between the
0049   //! segment L and the loaded shape.
0050   //!
0051   //! PInf is the smallest parameter on the line
0052   //! PSup is the highest parameter on the line
0053   //!
0054   //! For an infinite line PInf and PSup can be
0055   //! +/- RealLast.
0056   Standard_EXPORT void Perform(const gp_Lin& L, const double PInf, const double PSup);
0057 
0058   //! Perform the intersection between the
0059   //! segment L and the loaded shape.
0060   //!
0061   //! PInf is the smallest parameter on the line
0062   //! PSup is the highest parameter on the line
0063   //!
0064   //! For an infinite line PInf and PSup can be
0065   //! +/- RealLast.
0066   Standard_EXPORT void PerformNearest(const gp_Lin& L, const double PInf, const double PSup);
0067 
0068   //! same method for a HCurve from Adaptor3d.
0069   //! PInf an PSup can also be -INF and +INF.
0070   Standard_EXPORT void Perform(const occ::handle<Adaptor3d_Curve>& HCu,
0071                                const double                        PInf,
0072                                const double                        PSup);
0073 
0074   //! True when the intersection has been computed.
0075   bool IsDone() const { return myIsDone; }
0076 
0077   //! Returns the number of the intersection points
0078   int NbPnt() const { return myIndexPt.Length(); }
0079 
0080   //! Returns the U parameter of the ith intersection point
0081   //! on the surface.
0082   double UParameter(const int I) const
0083   {
0084     occ::handle<IntCurvesFace_Intersector> anIntAdaptor = myIntersector(myIndexFace(myIndexPt(I)));
0085     return anIntAdaptor->UParameter(myIndexIntPnt(myIndexPt(I)));
0086   }
0087 
0088   //! Returns the V parameter of the ith intersection point
0089   //! on the surface.
0090   double VParameter(const int I) const
0091   {
0092     occ::handle<IntCurvesFace_Intersector> anIntAdaptor = myIntersector(myIndexFace(myIndexPt(I)));
0093     return anIntAdaptor->VParameter(myIndexIntPnt(myIndexPt(I)));
0094   }
0095 
0096   //! Returns the parameter of the ith intersection point
0097   //! on the line.
0098   double WParameter(const int I) const
0099   {
0100     occ::handle<IntCurvesFace_Intersector> anIntAdaptor = myIntersector(myIndexFace(myIndexPt(I)));
0101     return anIntAdaptor->WParameter(myIndexIntPnt(myIndexPt(I)));
0102   }
0103 
0104   //! Returns the geometric point of the ith intersection
0105   //! between the line and the surface.
0106   const gp_Pnt& Pnt(const int I) const
0107   {
0108     occ::handle<IntCurvesFace_Intersector> anIntAdaptor = myIntersector(myIndexFace(myIndexPt(I)));
0109     return anIntAdaptor->Pnt(myIndexIntPnt(myIndexPt(I)));
0110   }
0111 
0112   //! Returns the ith transition of the line on the surface.
0113   IntCurveSurface_TransitionOnCurve Transition(const int I) const
0114   {
0115     occ::handle<IntCurvesFace_Intersector> anIntAdaptor = myIntersector(myIndexFace(myIndexPt(I)));
0116     return anIntAdaptor->Transition(myIndexIntPnt(myIndexPt(I)));
0117   }
0118 
0119   //! Returns the ith state of the point on the face.
0120   //! The values can be either TopAbs_IN
0121   //! ( the point is in the face)
0122   //! or TopAbs_ON
0123   //! ( the point is on a boundary of the face).
0124   TopAbs_State State(const int I) const
0125   {
0126     occ::handle<IntCurvesFace_Intersector> anIntAdaptor = myIntersector(myIndexFace(myIndexPt(I)));
0127     return anIntAdaptor->State(myIndexIntPnt(myIndexPt(I)));
0128   }
0129 
0130   //! Returns the significant face used to determine
0131   //! the intersection.
0132   const TopoDS_Face& Face(const int I) const
0133   {
0134     occ::handle<IntCurvesFace_Intersector> anIntAdaptor = myIntersector(myIndexFace(myIndexPt(I)));
0135     return anIntAdaptor->Face();
0136   }
0137 
0138   //! Internal method. Sort the result on the Curve
0139   //! parameter.
0140   Standard_EXPORT void SortResult();
0141 
0142   Standard_EXPORT virtual ~IntCurvesFace_ShapeIntersector();
0143 
0144 private:
0145   bool                                                         myIsDone;
0146   int                                                          myNbFaces;
0147   NCollection_Array1<int>                                      myPtrNums;
0148   NCollection_Array1<int>                                      myPtrIndexNums;
0149   NCollection_Sequence<occ::handle<IntCurvesFace_Intersector>> myIntersector;
0150   NCollection_Sequence<int>                                    myIndexPt;
0151   NCollection_Sequence<int>                                    myIndexFace;
0152   NCollection_Sequence<int>                                    myIndexIntPnt;
0153   NCollection_Sequence<double>                                 myIndexPar;
0154 };
0155 
0156 #endif // _IntCurvesFace_ShapeIntersector_HeaderFile