1 // Created on: 1992-04-06
2 // Created by: Jacques GOUSSARD
3 // Copyright (c) 1992-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #ifndef _IntPatch_ALine_HeaderFile
18 #define _IntPatch_ALine_HeaderFile
20 #include <Standard_Handle.hxx>
22 #include <IntAna_Curve.hxx>
23 #include <IntPatch_Line.hxx>
24 #include <IntPatch_SequenceOfPoint.hxx>
25 #include <TColStd_ListOfReal.hxx>
31 DEFINE_STANDARD_HANDLE(IntPatch_ALine, IntPatch_Line)
33 //! Implementation of an intersection line described by a
34 //! parametrized curve.
35 class IntPatch_ALine : public IntPatch_Line
41 //! Creates an analytic intersection line
42 //! when the transitions are In or Out.
43 Standard_EXPORT IntPatch_ALine(const IntAna_Curve& C, const Standard_Boolean Tang, const IntSurf_TypeTrans Trans1, const IntSurf_TypeTrans Trans2);
45 //! Creates an analytic intersection line
46 //! when the transitions are Touch.
47 Standard_EXPORT IntPatch_ALine(const IntAna_Curve& C, const Standard_Boolean Tang, const IntSurf_Situation Situ1, const IntSurf_Situation Situ2);
49 //! Creates an analytic intersection line
50 //! when the transitions are Undecided.
51 Standard_EXPORT IntPatch_ALine(const IntAna_Curve& C, const Standard_Boolean Tang);
53 //! To add a vertex in the list.
54 Standard_EXPORT void AddVertex (const IntPatch_Point& Pnt);
56 //! Replaces the element of range Index in the list
58 void Replace (const Standard_Integer Index, const IntPatch_Point& Pnt);
60 void SetFirstPoint (const Standard_Integer IndFirst);
62 void SetLastPoint (const Standard_Integer IndLast);
64 //! Returns the first parameter on the intersection line.
65 //! If IsIncluded returns True, Value and D1 methods can
66 //! be call with a parameter equal to FirstParamater.
67 //! Otherwise, the parameter must be greater than
69 Standard_Real FirstParameter (Standard_Boolean& IsIncluded) const;
71 //! Returns the last parameter on the intersection line.
72 //! If IsIncluded returns True, Value and D1 methods can
73 //! be call with a parameter equal to LastParamater.
74 //! Otherwise, the parameter must be less than LastParameter.
75 Standard_Real LastParameter (Standard_Boolean& IsIncluded) const;
77 //! Returns the point of parameter U on the analytic
78 //! intersection line.
79 gp_Pnt Value (const Standard_Real U);
81 //! Returns Standard_True when the derivative at parameter U
82 //! is defined on the analytic intersection line.
83 //! In that case, Du is the derivative.
84 //! Returns Standard_False when it is not possible to
85 //! evaluate the derivative.
86 //! In both cases, P is the point at parameter U on the
88 Standard_Boolean D1 (const Standard_Real U, gp_Pnt& P, gp_Vec& Du);
90 //! Tries to find the parameters of the point P on the curve.
91 //! If the method returns False, the "projection" is
93 //! If the method returns True at least one parameter has been found.
94 //! theParams is always sorted in ascending order.
95 void FindParameter(const gp_Pnt& P,
96 TColStd_ListOfReal& theParams) const;
98 //! Returns True if the line has a known First point.
99 //! This point is given by the method FirstPoint().
100 Standard_Boolean HasFirstPoint() const;
102 //! Returns True if the line has a known Last point.
103 //! This point is given by the method LastPoint().
104 Standard_Boolean HasLastPoint() const;
106 //! Returns the IntPoint corresponding to the FirstPoint.
107 //! An exception is raised when HasFirstPoint returns False.
108 const IntPatch_Point& FirstPoint() const;
110 //! Returns the IntPoint corresponding to the LastPoint.
111 //! An exception is raised when HasLastPoint returns False.
112 const IntPatch_Point& LastPoint() const;
114 Standard_Integer NbVertex() const;
116 //! Returns the vertex of range Index on the line.
117 const IntPatch_Point& Vertex (const Standard_Integer Index) const;
119 //! Allows modifying the vertex with index theIndex on the line.
120 IntPatch_Point& ChangeVertex(const Standard_Integer theIndex)
122 return svtx.ChangeValue(theIndex);
125 //! Set the parameters of all the vertex on the line.
126 //! if a vertex is already in the line,
127 //! its parameter is modified
128 //! else a new point in the line is inserted.
129 Standard_EXPORT void ComputeVertexParameters (const Standard_Real Tol);
131 Standard_EXPORT const IntAna_Curve& Curve() const;
136 DEFINE_STANDARD_RTTIEXT(IntPatch_ALine,IntPatch_Line)
147 Standard_Boolean fipt;
148 Standard_Boolean lapt;
149 Standard_Integer indf;
150 Standard_Integer indl;
151 IntPatch_SequenceOfPoint svtx;
157 #include <IntPatch_ALine.lxx>
163 #endif // _IntPatch_ALine_HeaderFile