Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:04:06

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