Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-22 08:58:34

0001 // Created on: 1995-05-29
0002 // Created by: Jacques GOUSSARD
0003 // Copyright (c) 1995-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 _LocOpe_CurveShapeIntersector_HeaderFile
0018 #define _LocOpe_CurveShapeIntersector_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 
0023 #include <LocOpe_PntFace.hxx>
0024 #include <NCollection_Sequence.hxx>
0025 #include <Standard_Integer.hxx>
0026 #include <TopAbs_Orientation.hxx>
0027 class gp_Ax1;
0028 class TopoDS_Shape;
0029 class gp_Circ;
0030 class LocOpe_PntFace;
0031 
0032 //! This class provides the intersection between an
0033 //! axis or a circle and the faces of a shape. The
0034 //! intersection points are sorted in increasing
0035 //! parameter along the axis.
0036 class LocOpe_CurveShapeIntersector
0037 {
0038 public:
0039   DEFINE_STANDARD_ALLOC
0040 
0041   //! Empty constructor.
0042   LocOpe_CurveShapeIntersector();
0043 
0044   //! Creates and performs the intersection between
0045   //! <Ax1> and <S>.
0046   LocOpe_CurveShapeIntersector(const gp_Ax1& Axis, const TopoDS_Shape& S);
0047 
0048   //! Creates and performs the intersection between
0049   //! <C> and <S>.
0050   LocOpe_CurveShapeIntersector(const gp_Circ& C, const TopoDS_Shape& S);
0051 
0052   //! Performs the intersection between <Ax1 and <S>.
0053   Standard_EXPORT void Init(const gp_Ax1& Axis, const TopoDS_Shape& S);
0054 
0055   //! Performs the intersection between <Ax1 and <S>.
0056   Standard_EXPORT void Init(const gp_Circ& C, const TopoDS_Shape& S);
0057 
0058   //! Returns <true> if the intersection has
0059   //! been done.
0060   bool IsDone() const;
0061 
0062   //! Returns the number of intersection point.
0063   int NbPoints() const;
0064 
0065   //! Returns the intersection point of range <Index>.
0066   //! The points are sorted in increasing order of
0067   //! parameter along the axis.
0068   const LocOpe_PntFace& Point(const int Index) const;
0069 
0070   //! Searches the first intersection point located
0071   //! after the parameter <From>, which orientation is
0072   //! not TopAbs_EXTERNAL. If found, returns
0073   //! <true>. <Or> contains the orientation of
0074   //! the point, <IndFrom> and <IndTo> represents the
0075   //! interval of index in the sequence of intersection
0076   //! point corresponding to the point. (IndFrom <= IndTo).
0077   //!
0078   //! Otherwise, returns <false>.
0079   Standard_EXPORT bool LocalizeAfter(const double        From,
0080                                      TopAbs_Orientation& Or,
0081                                      int&                IndFrom,
0082                                      int&                IndTo) const;
0083 
0084   //! Searches the first intersection point located
0085   //! before the parameter <From>, which orientation is
0086   //! not TopAbs_EXTERNAL. If found, returns
0087   //! <true>. <Or> contains the orientation of
0088   //! the point, <IndFrom> and <IndTo> represents the
0089   //! interval of index in the sequence of intersection
0090   //! point corresponding to the point (IndFrom <= IndTo).
0091   //!
0092   //! Otherwise, returns <false>.
0093   Standard_EXPORT bool LocalizeBefore(const double        From,
0094                                       TopAbs_Orientation& Or,
0095                                       int&                IndFrom,
0096                                       int&                IndTo) const;
0097 
0098   //! Searches the first intersection point located
0099   //! after the index <FromInd> (>= FromInd + 1), which
0100   //! orientation is not TopAbs_EXTERNAL. If found,
0101   //! returns <true>. <Or> contains the
0102   //! orientation of the point, <IndFrom> and <IndTo>
0103   //! represents the interval of index in the sequence
0104   //! of intersection point corresponding to the point.
0105   //! (IndFrom <= IndTo).
0106   //!
0107   //! Otherwise, returns <false>.
0108   Standard_EXPORT bool LocalizeAfter(const int           FromInd,
0109                                      TopAbs_Orientation& Or,
0110                                      int&                IndFrom,
0111                                      int&                IndTo) const;
0112 
0113   //! Searches the first intersection point located
0114   //! before the index <FromInd> ( <= FromInd -1), which
0115   //! orientation is not TopAbs_EXTERNAL. If found,
0116   //! returns <true>. <Or> contains the
0117   //! orientation of the point, <IndFrom> and <IndTo>
0118   //! represents the interval of index in the sequence
0119   //! of intersection point corresponding to the point
0120   //! (IndFrom <= IndTo).
0121   //!
0122   //! Otherwise, returns <false>.
0123   Standard_EXPORT bool LocalizeBefore(const int           FromInd,
0124                                       TopAbs_Orientation& Or,
0125                                       int&                IndFrom,
0126                                       int&                IndTo) const;
0127 
0128 private:
0129   bool                                 myDone;
0130   NCollection_Sequence<LocOpe_PntFace> myPoints;
0131 };
0132 
0133 #include <LocOpe_CurveShapeIntersector.lxx>
0134 
0135 #endif // _LocOpe_CurveShapeIntersector_HeaderFile