Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-10-02 09:12:54

0001 // Created on: 1992-04-06
0002 // Created by: Jacques GOUSSARD
0003 // Copyright (c) 1992-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 _IntPatch_RLine_HeaderFile
0018 #define _IntPatch_RLine_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 
0022 #include <Standard_Real.hxx>
0023 #include <Standard_Integer.hxx>
0024 #include <IntPatch_Point.hxx>
0025 #include <NCollection_Sequence.hxx>
0026 #include <IntPatch_PointLine.hxx>
0027 #include <IntSurf_LineOn2S.hxx>
0028 #include <IntSurf_Situation.hxx>
0029 #include <IntSurf_TypeTrans.hxx>
0030 
0031 class IntPatch_Point;
0032 class IntSurf_PntOn2S;
0033 
0034 //! Implementation of an intersection line described by a
0035 //! restriction line on one of the surfaces.
0036 class IntPatch_RLine : public IntPatch_PointLine
0037 {
0038 
0039 public:
0040   //! Creates a restriction as an intersection line
0041   //! when the transitions are In or Out.
0042   Standard_EXPORT IntPatch_RLine(const bool              Tang,
0043                                  const IntSurf_TypeTrans Trans1,
0044                                  const IntSurf_TypeTrans Trans2);
0045 
0046   //! Creates a restriction as an intersection line
0047   //! when the transitions are Touch.
0048   Standard_EXPORT IntPatch_RLine(const bool              Tang,
0049                                  const IntSurf_Situation Situ1,
0050                                  const IntSurf_Situation Situ2);
0051 
0052   //! Creates a restriction as an intersection line
0053   //! when the transitions are Undecided.
0054   Standard_EXPORT IntPatch_RLine(const bool Tang);
0055 
0056   //! Adds a vertex in the list. If theIsPrepend == TRUE the new
0057   //! vertex will be added before the first element of vertices sequence.
0058   //! Otherwise, to the end of the sequence
0059   void AddVertex(const IntPatch_Point& Pnt, const bool theIsPrepend = false) override;
0060 
0061   //! Replaces the element of range Index in the list
0062   //! of points.
0063   void Replace(const int Index, const IntPatch_Point& Pnt);
0064 
0065   void SetFirstPoint(const int IndFirst);
0066 
0067   void SetLastPoint(const int IndLast);
0068 
0069   void Add(const occ::handle<IntSurf_LineOn2S>& L);
0070 
0071   //! Returns True if the intersection is on the domain of the
0072   //! first patch.
0073   //! Returns False if the intersection is on the domain of
0074   //! the second patch.
0075   bool IsArcOnS1() const;
0076 
0077   //! Returns True if the intersection is on the domain of the
0078   //! first patch.
0079   //! Returns False if the intersection is on the domain of
0080   //! the second patch.
0081   bool IsArcOnS2() const;
0082 
0083   Standard_EXPORT void SetArcOnS1(const occ::handle<Adaptor2d_Curve2d>& A);
0084 
0085   Standard_EXPORT void SetArcOnS2(const occ::handle<Adaptor2d_Curve2d>& A);
0086 
0087   Standard_EXPORT void SetParamOnS1(const double p1, const double p2);
0088 
0089   Standard_EXPORT void SetParamOnS2(double& p1, double& p2);
0090 
0091   //! Returns the concerned arc.
0092   const occ::handle<Adaptor2d_Curve2d>& ArcOnS1() const;
0093 
0094   //! Returns the concerned arc.
0095   const occ::handle<Adaptor2d_Curve2d>& ArcOnS2() const;
0096 
0097   Standard_EXPORT void ParamOnS1(double& p1, double& p2) const;
0098 
0099   Standard_EXPORT void ParamOnS2(double& p1, double& p2) const;
0100 
0101   //! Returns True if the line has a known First point.
0102   //! This point is given by the method FirstPoint().
0103   bool HasFirstPoint() const;
0104 
0105   //! Returns True if the line has a known Last point.
0106   //! This point is given by the method LastPoint().
0107   bool HasLastPoint() const;
0108 
0109   //! Returns the IntPoint corresponding to the FirstPoint.
0110   //! An exception is raised when HasFirstPoint returns False.
0111   const IntPatch_Point& FirstPoint() const;
0112 
0113   //! Returns the IntPoint corresponding to the LastPoint.
0114   //! An exception is raised when HasLastPoint returns False.
0115   const IntPatch_Point& LastPoint() const;
0116 
0117   //! Returns number of vertices (IntPatch_Point) of the line
0118   int NbVertex() const override;
0119 
0120   //! Returns the vertex of range Index on the line.
0121   const IntPatch_Point& Vertex(const int Index) const override;
0122 
0123   //! Returns the vertex of range Index on the line.
0124   IntPatch_Point& ChangeVertex(const int Index) override;
0125 
0126   //! Removes single vertex from the line
0127   void RemoveVertex(const int theIndex) override;
0128 
0129   bool HasPolygon() const;
0130 
0131   //! Returns the number of intersection points.
0132   int NbPnts() const override;
0133 
0134   //! Returns the intersection point of range Index.
0135   const IntSurf_PntOn2S& Point(const int Index) const override;
0136 
0137   //! Set the Point of index <Index> in the LineOn2S
0138   Standard_EXPORT void SetPoint(const int Index, const IntPatch_Point& Pnt);
0139 
0140   //! Set the parameters of all the vertex on the line.
0141   //! if a vertex is already in the line,
0142   //! its parameter is modified
0143   //! else a new point in the line is inserted.
0144   Standard_EXPORT void ComputeVertexParameters(const double Tol);
0145 
0146   //! Returns set of intersection points
0147   occ::handle<IntSurf_LineOn2S> Curve() const override;
0148 
0149   //! Returns TRUE if theP is out of the box built from
0150   //! the points on 1st surface
0151   bool IsOutSurf1Box(const gp_Pnt2d& theP) const override { return curv->IsOutSurf1Box(theP); }
0152 
0153   //! Returns TRUE if theP is out of the box built from
0154   //! the points on 2nd surface
0155   bool IsOutSurf2Box(const gp_Pnt2d& theP) const override { return curv->IsOutSurf2Box(theP); }
0156 
0157   //! Returns TRUE if theP is out of the box built from 3D-points.
0158   bool IsOutBox(const gp_Pnt& theP) const override { return curv->IsOutBox(theP); }
0159 
0160   //! Removes vertices from the line (i.e. cleans svtx member)
0161   void ClearVertexes() override { svtx.Clear(); }
0162 
0163   void SetCurve(const occ::handle<IntSurf_LineOn2S>& theNewCurve) { curv = theNewCurve; }
0164 
0165   //! if (theMode == 0) then prints the information about WLine
0166   //! if (theMode == 1) then prints the list of 3d-points
0167   //! if (theMode == 2) then prints the list of 2d-points on the 1st surface
0168   //! Otherwise, prints list of 2d-points on the 2nd surface
0169   Standard_EXPORT void Dump(const int theMode) const;
0170 
0171   DEFINE_STANDARD_RTTIEXT(IntPatch_RLine, IntPatch_PointLine)
0172 
0173 private:
0174   occ::handle<Adaptor2d_Curve2d>       theArcOnS1;
0175   occ::handle<Adaptor2d_Curve2d>       theArcOnS2;
0176   bool                                 onS1;
0177   bool                                 onS2;
0178   double                               ParamInf1;
0179   double                               ParamSup1;
0180   double                               ParamInf2;
0181   double                               ParamSup2;
0182   occ::handle<IntSurf_LineOn2S>        curv;
0183   bool                                 fipt;
0184   bool                                 lapt;
0185   int                                  indf;
0186   int                                  indl;
0187   NCollection_Sequence<IntPatch_Point> svtx;
0188 };
0189 
0190 #include <IntPatch_RLine.lxx>
0191 
0192 #endif // _IntPatch_RLine_HeaderFile