1 // Created on: 1994-09-05
2 // Created by: Yves FRICAUD
3 // Copyright (c) 1994-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.
19 #include <LProp_CurAndInf.hxx>
20 #include <Standard_OutOfRange.hxx>
22 //=======================================================================
23 //function : LProp_CurAndInf
25 //=======================================================================
26 LProp_CurAndInf::LProp_CurAndInf()
31 //=======================================================================
32 //function : AddInflection
34 //=======================================================================
36 void LProp_CurAndInf::AddInflection(const Standard_Real Param)
38 if (theParams.IsEmpty()) {
39 theParams.Append(Param);
40 theTypes .Append(LProp_Inflection);
43 if (Param > theParams.Last()) {
44 theParams.Append(Param);
45 theTypes .Append(LProp_Inflection);
48 for (Standard_Integer i = 1; i <= theParams.Length(); i++) {
49 if (theParams.Value(i) > Param) {
50 theParams.InsertBefore(i, Param);
51 theTypes .InsertBefore(i, LProp_Inflection);
58 //=======================================================================
59 //function : AddExtCur
61 //=======================================================================
63 void LProp_CurAndInf::AddExtCur(const Standard_Real Param,
64 const Standard_Boolean IsMin)
66 LProp_CIType TypePoint;
67 if (IsMin ) TypePoint = LProp_MinCur; else TypePoint = LProp_MaxCur;
69 if (theParams.IsEmpty()) {
70 theParams.Append(Param);
71 theTypes .Append(TypePoint);
74 if (Param > theParams.Last()) {
75 theParams.Append(Param);
76 theTypes .Append(TypePoint);
79 for (Standard_Integer i = 1; i <= theParams.Length(); i++) {
80 if (theParams.Value(i) > Param) {
81 theParams.InsertBefore(i, Param);
82 theTypes .InsertBefore(i, TypePoint);
88 //=======================================================================
91 //=======================================================================
93 void LProp_CurAndInf::Clear()
100 //=======================================================================
103 //=======================================================================
105 Standard_Boolean LProp_CurAndInf::IsEmpty() const
107 return theParams.IsEmpty();
111 //=======================================================================
112 //function : NbPoints
114 //=======================================================================
116 Standard_Integer LProp_CurAndInf::NbPoints() const
118 return theParams.Length();
122 //=======================================================================
123 //function : Parameter
125 //=======================================================================
127 Standard_Real LProp_CurAndInf::Parameter(const Standard_Integer N) const
129 if (N <1 || N > NbPoints ()) {throw Standard_OutOfRange();}
130 return theParams.Value(N);
134 //=======================================================================
137 //=======================================================================
139 LProp_CIType LProp_CurAndInf::Type(const Standard_Integer N) const
141 if (N <1 || N > NbPoints()) {throw Standard_OutOfRange();}
142 return theTypes.Value(N);