Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-25 09:20:24

0001 // Created on: 1991-05-27
0002 // Created by: Isabelle GRIGNON
0003 // Copyright (c) 1991-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_WLine_HeaderFile
0018 #define _IntPatch_WLine_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 
0022 #include <Standard_Integer.hxx>
0023 #include <IntPatch_Point.hxx>
0024 #include <NCollection_Sequence.hxx>
0025 #include <Standard_Real.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 class gp_Pnt2d;
0034 class gp_Pnt;
0035 
0036 //! Definition of set of points as a result of the intersection
0037 //! between 2 parametrised patches.
0038 class IntPatch_WLine : public IntPatch_PointLine
0039 {
0040 
0041 public:
0042   //! Enumeration of ways of WLine creation.
0043   enum IntPatch_WLType
0044   {
0045     IntPatch_WLUnknown,
0046     IntPatch_WLImpImp,
0047     IntPatch_WLImpPrm,
0048     IntPatch_WLPrmPrm
0049   };
0050 
0051   //! Creates a WLine as an intersection when the
0052   //! transitions are In or Out.
0053   Standard_EXPORT IntPatch_WLine(const occ::handle<IntSurf_LineOn2S>& Line,
0054                                  const bool                           Tang,
0055                                  const IntSurf_TypeTrans              Trans1,
0056                                  const IntSurf_TypeTrans              Trans2);
0057 
0058   //! Creates a WLine as an intersection when the
0059   //! transitions are Touch.
0060   Standard_EXPORT IntPatch_WLine(const occ::handle<IntSurf_LineOn2S>& Line,
0061                                  const bool                           Tang,
0062                                  const IntSurf_Situation              Situ1,
0063                                  const IntSurf_Situation              Situ2);
0064 
0065   //! Creates a WLine as an intersection when the
0066   //! transitions are Undecided.
0067   Standard_EXPORT IntPatch_WLine(const occ::handle<IntSurf_LineOn2S>& Line, const bool Tang);
0068 
0069   //! Adds a vertex in the list. If theIsPrepend == TRUE the new
0070   //! vertex will be added before the first element of vertices sequence.
0071   //! Otherwise, to the end of the sequence
0072   void AddVertex(const IntPatch_Point& Pnt, const bool theIsPrepend = false) override;
0073 
0074   //! Set the Point of index <Index> in the LineOn2S
0075   Standard_EXPORT void SetPoint(const int Index, const IntPatch_Point& Pnt);
0076 
0077   //! Replaces the element of range Index in the list
0078   //! of points.
0079   //! The exception OutOfRange is raised when
0080   //! Index <= 0 or Index > NbVertex.
0081   void Replace(const int Index, const IntPatch_Point& Pnt);
0082 
0083   void SetFirstPoint(const int IndFirst);
0084 
0085   void SetLastPoint(const int IndLast);
0086 
0087   //! Returns the number of intersection points.
0088   int NbPnts() const override;
0089 
0090   //! Returns the intersection point of range Index.
0091   const IntSurf_PntOn2S& Point(const int Index) const override;
0092 
0093   //! Returns True if the line has a known First point.
0094   //! This point is given by the method FirstPoint().
0095   bool HasFirstPoint() const;
0096 
0097   //! Returns True if the line has a known Last point.
0098   //! This point is given by the method LastPoint().
0099   bool HasLastPoint() const;
0100 
0101   //! Returns the Point corresponding to the FirstPoint.
0102   const IntPatch_Point& FirstPoint() const;
0103 
0104   //! Returns the Point corresponding to the LastPoint.
0105   const IntPatch_Point& LastPoint() const;
0106 
0107   //! Returns the Point corresponding to the FirstPoint.
0108   //! Indfirst is the index of the first in the list
0109   //! of vertices.
0110   const IntPatch_Point& FirstPoint(int& Indfirst) const;
0111 
0112   //! Returns the Point corresponding to the LastPoint.
0113   //! Indlast is the index of the last in the list
0114   //! of vertices.
0115   const IntPatch_Point& LastPoint(int& Indlast) 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   //! Set the parameters of all the vertex on the line.
0127   //! if a vertex is already in the line,
0128   //! its parameter is modified
0129   //! else a new point in the line is inserted.
0130   Standard_EXPORT void ComputeVertexParameters(const double Tol);
0131 
0132   //! Returns set of intersection points
0133   Standard_EXPORT occ::handle<IntSurf_LineOn2S> Curve() const override;
0134 
0135   //! Returns TRUE if theP is out of the box built from
0136   //! the points on 1st surface
0137   bool IsOutSurf1Box(const gp_Pnt2d& theP) const override { return curv->IsOutSurf1Box(theP); }
0138 
0139   //! Returns TRUE if theP is out of the box built from
0140   //! the points on 2nd surface
0141   bool IsOutSurf2Box(const gp_Pnt2d& theP) const override { return curv->IsOutSurf2Box(theP); }
0142 
0143   //! Returns TRUE if theP is out of the box built from 3D-points.
0144   bool IsOutBox(const gp_Pnt& theP) const override { return curv->IsOutBox(theP); }
0145 
0146   Standard_EXPORT void SetPeriod(const double pu1,
0147                                  const double pv1,
0148                                  const double pu2,
0149                                  const double pv2);
0150 
0151   Standard_EXPORT double U1Period() const;
0152 
0153   Standard_EXPORT double V1Period() const;
0154 
0155   Standard_EXPORT double U2Period() const;
0156 
0157   Standard_EXPORT double V2Period() const;
0158 
0159   Standard_EXPORT void SetArcOnS1(const occ::handle<Adaptor2d_Curve2d>& A);
0160 
0161   Standard_EXPORT bool HasArcOnS1() const;
0162 
0163   Standard_EXPORT const occ::handle<Adaptor2d_Curve2d>& GetArcOnS1() const;
0164 
0165   Standard_EXPORT void SetArcOnS2(const occ::handle<Adaptor2d_Curve2d>& A);
0166 
0167   Standard_EXPORT bool HasArcOnS2() const;
0168 
0169   Standard_EXPORT const occ::handle<Adaptor2d_Curve2d>& GetArcOnS2() const;
0170 
0171   //! Removes vertices from the line (i.e. cleans svtx member)
0172   void ClearVertexes() override;
0173 
0174   //! Removes single vertex from the line
0175   void RemoveVertex(const int theIndex) override;
0176 
0177   void InsertVertexBefore(const int theIndex, const IntPatch_Point& thePnt);
0178 
0179   //! if (theMode == 0) then prints the information about WLine
0180   //! if (theMode == 1) then prints the list of 3d-points
0181   //! if (theMode == 2) then prints the list of 2d-points on the 1st surface
0182   //! Otherwise, prints list of 2d-points on the 2nd surface
0183   Standard_EXPORT void Dump(const int theMode) const;
0184 
0185   //! Allows or forbids purging of existing WLine
0186   void EnablePurging(const bool theIsEnabled) { myIsPurgerAllowed = theIsEnabled; }
0187 
0188   //! Returns TRUE if purging is allowed or forbidden for existing WLine
0189   bool IsPurgingAllowed() { return myIsPurgerAllowed; }
0190 
0191   //! Returns the way of <*this> creation.
0192   IntPatch_WLType GetCreatingWay() const { return myCreationWay; }
0193 
0194   //! Sets the info about the way of <*this> creation.
0195   void SetCreatingWayInfo(IntPatch_WLType theAlgo) { myCreationWay = theAlgo; }
0196 
0197   DEFINE_STANDARD_RTTIEXT(IntPatch_WLine, IntPatch_PointLine)
0198 
0199 private:
0200   occ::handle<IntSurf_LineOn2S>        curv;
0201   bool                                 fipt;
0202   bool                                 lapt;
0203   int                                  indf;
0204   int                                  indl;
0205   NCollection_Sequence<IntPatch_Point> svtx;
0206   double                               u1period;
0207   double                               v1period;
0208   double                               u2period;
0209   double                               v2period;
0210   bool                                 hasArcOnS1;
0211   occ::handle<Adaptor2d_Curve2d>       theArcOnS1;
0212   bool                                 hasArcOnS2;
0213   occ::handle<Adaptor2d_Curve2d>       theArcOnS2;
0214   bool                                 myIsPurgerAllowed;
0215 
0216   //! identifies the way of <*this> creation
0217   IntPatch_WLType myCreationWay;
0218 };
0219 
0220 #include <IntPatch_WLine.lxx>
0221 
0222 #endif // _IntPatch_WLine_HeaderFile