Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-15 09:16:11

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_ALine_HeaderFile
0018 #define _IntPatch_ALine_HeaderFile
0019 
0020 #include <Standard_Handle.hxx>
0021 
0022 #include <IntAna_Curve.hxx>
0023 #include <IntPatch_Line.hxx>
0024 #include <IntPatch_Point.hxx>
0025 #include <NCollection_Sequence.hxx>
0026 #include <NCollection_List.hxx>
0027 
0028 class IntPatch_Point;
0029 
0030 //! Implementation of an intersection line described by a
0031 //! parametrized curve.
0032 class IntPatch_ALine : public IntPatch_Line
0033 {
0034 
0035 public:
0036   //! Creates an analytic intersection line
0037   //! when the transitions are In or Out.
0038   Standard_EXPORT IntPatch_ALine(const IntAna_Curve&     C,
0039                                  const bool              Tang,
0040                                  const IntSurf_TypeTrans Trans1,
0041                                  const IntSurf_TypeTrans Trans2);
0042 
0043   //! Creates an analytic intersection line
0044   //! when the transitions are Touch.
0045   Standard_EXPORT IntPatch_ALine(const IntAna_Curve&     C,
0046                                  const bool              Tang,
0047                                  const IntSurf_Situation Situ1,
0048                                  const IntSurf_Situation Situ2);
0049 
0050   //! Creates an analytic intersection line
0051   //! when the transitions are Undecided.
0052   Standard_EXPORT IntPatch_ALine(const IntAna_Curve& C, const bool Tang);
0053 
0054   //! To add a vertex in the list.
0055   Standard_EXPORT void AddVertex(const IntPatch_Point& Pnt);
0056 
0057   //! Replaces the element of range Index in the list
0058   //! of points.
0059   void Replace(const int Index, const IntPatch_Point& Pnt);
0060 
0061   void SetFirstPoint(const int IndFirst);
0062 
0063   void SetLastPoint(const int IndLast);
0064 
0065   //! Returns the first parameter on the intersection line.
0066   //! If IsIncluded returns True, Value and D1 methods can
0067   //! be call with a parameter equal to FirstParameter.
0068   //! Otherwise, the parameter must be greater than
0069   //! FirstParameter.
0070   double FirstParameter(bool& IsIncluded) const;
0071 
0072   //! Returns the last parameter on the intersection line.
0073   //! If IsIncluded returns True, Value and D1 methods can
0074   //! be call with a parameter equal to LastParameter.
0075   //! Otherwise, the parameter must be less than LastParameter.
0076   double LastParameter(bool& IsIncluded) const;
0077 
0078   //! Returns the point of parameter U on the analytic
0079   //! intersection line.
0080   gp_Pnt Value(const double U);
0081 
0082   //! Returns true when the derivative at parameter U
0083   //! is defined on the analytic intersection line.
0084   //! In that case, Du is the derivative.
0085   //! Returns false when it is not possible to
0086   //! evaluate the derivative.
0087   //! In both cases, P is the point at parameter U on the
0088   //! intersection.
0089   bool D1(const double U, gp_Pnt& P, gp_Vec& Du);
0090 
0091   //! Tries to find the parameters of the point P on the curve.
0092   //! If the method returns False, the "projection" is
0093   //! impossible.
0094   //! If the method returns True at least one parameter has been found.
0095   //! theParams is always sorted in ascending order.
0096   void FindParameter(const gp_Pnt& P, NCollection_List<double>& theParams) const;
0097 
0098   //! Returns True if the line has a known First point.
0099   //! This point is given by the method FirstPoint().
0100   bool HasFirstPoint() const;
0101 
0102   //! Returns True if the line has a known Last point.
0103   //! This point is given by the method LastPoint().
0104   bool HasLastPoint() const;
0105 
0106   //! Returns the IntPoint corresponding to the FirstPoint.
0107   //! An exception is raised when HasFirstPoint returns False.
0108   const IntPatch_Point& FirstPoint() const;
0109 
0110   //! Returns the IntPoint corresponding to the LastPoint.
0111   //! An exception is raised when HasLastPoint returns False.
0112   const IntPatch_Point& LastPoint() const;
0113 
0114   int NbVertex() const;
0115 
0116   //! Returns the vertex of range Index on the line.
0117   const IntPatch_Point& Vertex(const int Index) const;
0118 
0119   //! Allows modifying the vertex with index theIndex on the line.
0120   IntPatch_Point& ChangeVertex(const int theIndex) { return svtx.ChangeValue(theIndex); }
0121 
0122   //! Set the parameters of all the vertex on the line.
0123   //! if a vertex is already in the line,
0124   //! its parameter is modified
0125   //! else a new point in the line is inserted.
0126   Standard_EXPORT void ComputeVertexParameters(const double Tol);
0127 
0128   Standard_EXPORT const IntAna_Curve& Curve() const;
0129 
0130   DEFINE_STANDARD_RTTIEXT(IntPatch_ALine, IntPatch_Line)
0131 
0132 private:
0133   IntAna_Curve                         curv;
0134   bool                                 fipt;
0135   bool                                 lapt;
0136   int                                  indf;
0137   int                                  indl;
0138   NCollection_Sequence<IntPatch_Point> svtx;
0139 };
0140 
0141 #include <IntPatch_ALine.lxx>
0142 
0143 #endif // _IntPatch_ALine_HeaderFile