Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-21 09:17:36

0001 // Created on: 1996-05-31
0002 // Created by: Laurent BUCHARD
0003 // Copyright (c) 1996-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_Intersector_HeaderFile
0018 #define _IntCurvesFace_Intersector_HeaderFile
0019 
0020 #include <Adaptor3d_Curve.hxx>
0021 #include <Bnd_BoundSortBox.hxx>
0022 #include <BRepAdaptor_Surface.hxx>
0023 #include <IntCurveSurface_IntersectionPoint.hxx>
0024 #include <NCollection_Sequence.hxx>
0025 #include <IntCurveSurface_ThePolyhedronOfHInter.hxx>
0026 #include <Standard_Integer.hxx>
0027 #include <TopoDS_Face.hxx>
0028 #include <GeomAbs_SurfaceType.hxx>
0029 #include <IntCurveSurface_TransitionOnCurve.hxx>
0030 #include <TopAbs_State.hxx>
0031 
0032 #include <memory>
0033 
0034 class BRepTopAdaptor_TopolTool;
0035 class gp_Lin;
0036 class gp_Pnt;
0037 class IntCurveSurface_HInter;
0038 class gp_Pnt2d;
0039 class Bnd_Box;
0040 
0041 class IntCurvesFace_Intersector : public Standard_Transient
0042 {
0043   DEFINE_STANDARD_RTTIEXT(IntCurvesFace_Intersector, Standard_Transient)
0044 
0045 public:
0046   DEFINE_STANDARD_ALLOC
0047 
0048   //! Load a Face.
0049   //!
0050   //! The Tolerance <Tol> is used to determine if the
0051   //! first point of the segment is near the face. In
0052   //! that case, the parameter of the intersection point
0053   //! on the line can be a negative value (greater than -Tol).
0054   //! If aRestr = true UV bounding box of face is used to restrict
0055   //! it's underlined surface,
0056   //! otherwise surface is not restricted.
0057   //! If UseBToler = false then the 2d-point of intersection is classified with null-tolerance
0058   //! (relative to face);
0059   //! otherwise it's using maximum between input tolerance(aTol) and tolerances of face bounds
0060   //! (edges).
0061   Standard_EXPORT IntCurvesFace_Intersector(const TopoDS_Face& F,
0062                                             const double       aTol,
0063                                             const bool         aRestr    = true,
0064                                             const bool         UseBToler = true);
0065 
0066   //! Perform the intersection between the
0067   //! segment L and the loaded face.
0068   //!
0069   //! PInf is the smallest parameter on the line
0070   //! PSup is the highest parameter on the line
0071   //!
0072   //! For an infinite line PInf and PSup can be
0073   //! +/- RealLast.
0074   Standard_EXPORT void Perform(const gp_Lin& L, const double PInf, const double PSup);
0075 
0076   //! same method for a HCurve from Adaptor3d.
0077   //! PInf an PSup can also be - and + INF.
0078   Standard_EXPORT void Perform(const occ::handle<Adaptor3d_Curve>& HCu,
0079                                const double                        PInf,
0080                                const double                        PSup);
0081 
0082   //! Return the surface type
0083   Standard_EXPORT GeomAbs_SurfaceType SurfaceType() const;
0084 
0085   //! True is returned when the intersection have been computed.
0086   bool IsDone() const;
0087 
0088   int NbPnt() const;
0089 
0090   //! Returns the U parameter of the ith intersection point
0091   //! on the surface.
0092   double UParameter(const int I) const;
0093 
0094   //! Returns the V parameter of the ith intersection point
0095   //! on the surface.
0096   double VParameter(const int I) const;
0097 
0098   //! Returns the parameter of the ith intersection point
0099   //! on the line.
0100   double WParameter(const int I) const;
0101 
0102   //! Returns the geometric point of the ith intersection
0103   //! between the line and the surface.
0104   const gp_Pnt& Pnt(const int I) const;
0105 
0106   //! Returns the ith transition of the line on the surface.
0107   IntCurveSurface_TransitionOnCurve Transition(const int I) const;
0108 
0109   //! Returns the ith state of the point on the face.
0110   //! The values can be either TopAbs_IN
0111   //! ( the point is in the face)
0112   //! or TopAbs_ON
0113   //! ( the point is on a boundary of the face).
0114   TopAbs_State State(const int I) const;
0115 
0116   //! Returns true if curve is parallel or belongs face surface
0117   //! This case is recognized only for some pairs
0118   //! of analytical curves and surfaces (plane - line, ...)
0119   bool IsParallel() const;
0120 
0121   //! Returns the significant face used to determine
0122   //! the intersection.
0123   const TopoDS_Face& Face() const;
0124 
0125   Standard_EXPORT TopAbs_State ClassifyUVPoint(const gp_Pnt2d& Puv) const;
0126 
0127   Standard_EXPORT Bnd_Box Bounding() const;
0128 
0129   //! Sets the boundary tolerance flag
0130   Standard_EXPORT void SetUseBoundToler(bool UseBToler);
0131 
0132   //! Returns the boundary tolerance flag
0133   Standard_EXPORT bool GetUseBoundToler() const;
0134 
0135   Standard_EXPORT ~IntCurvesFace_Intersector() override;
0136 
0137 private:
0138   Standard_EXPORT void InternalCall(const IntCurveSurface_HInter& HICS,
0139                                     const double                  pinf,
0140                                     const double                  psup);
0141 
0142   occ::handle<BRepTopAdaptor_TopolTool>                   myTopolTool;
0143   occ::handle<BRepAdaptor_Surface>                        Hsurface;
0144   double                                                  Tol;
0145   NCollection_Sequence<IntCurveSurface_IntersectionPoint> SeqPnt;
0146   NCollection_Sequence<int>                               mySeqState;
0147   bool                                                    done;
0148   bool                                                    myReady;
0149   int                                                     nbpnt;
0150   TopoDS_Face                                             face;
0151   std::unique_ptr<IntCurveSurface_ThePolyhedronOfHInter>  myPolyhedron;
0152   std::unique_ptr<Bnd_BoundSortBox>                       myBndBounding;
0153   bool                                                    myUseBoundTol;
0154   bool myIsParallel; // Curve is "parallel" face surface
0155                      // This case is recognized only for some pairs
0156                      // of analytical curves and surfaces (plane - line, ...)
0157 };
0158 
0159 #include <IntCurvesFace_Intersector.lxx>
0160 
0161 #endif // _IntCurvesFace_Intersector_HeaderFile