summaryrefslogtreecommitdiff
path: root/src/LProp/LProp_CurAndInf.cxx
blob: 3aeb502d83b61ad694d994028de70ea76dde646a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
// File:	LProp_CurAndInf.cxx
// Created:	Mon Sep  5 10:43:19 1994
// Author:	Yves FRICAUD
//		<yfr@ecolox>


#include <LProp_CurAndInf.ixx>
#include <Standard_OutOfRange.hxx>
#include <ElCLib.hxx>

//=======================================================================
//function : LProp_CurAndInf
//purpose  : 
//=======================================================================

LProp_CurAndInf::LProp_CurAndInf()
{
}


//=======================================================================
//function : AddInflection
//purpose  : 
//=======================================================================

void LProp_CurAndInf::AddInflection(const Standard_Real Param)
{
  if (theParams.IsEmpty()) {
    theParams.Append(Param);
    theTypes .Append(LProp_Inflection);
    return;
  }
  if (Param > theParams.Last()) {
    theParams.Append(Param);
    theTypes .Append(LProp_Inflection);
    return;
  }
  for (Standard_Integer i = 1; i <= theParams.Length(); i++) {
    if (theParams.Value(i) > Param) {
      theParams.InsertBefore(i, Param);
      theTypes .InsertBefore(i, LProp_Inflection);
      break;
    }
  }
}


//=======================================================================
//function : AddExtCur
//purpose  : 
//=======================================================================

void LProp_CurAndInf::AddExtCur(const Standard_Real    Param, 
				const Standard_Boolean IsMin)
{ 
  LProp_CIType TypePoint;
  if (IsMin )  TypePoint = LProp_MinCur; else TypePoint = LProp_MaxCur;

  if (theParams.IsEmpty()) {
    theParams.Append(Param);
    theTypes .Append(TypePoint);
    return;
  }
  if (Param > theParams.Last()) {
    theParams.Append(Param);
    theTypes .Append(TypePoint);
    return;
  }
  for (Standard_Integer i = 1; i <= theParams.Length(); i++) {
    if (theParams.Value(i) > Param) {
      theParams.InsertBefore(i, Param);
      theTypes .InsertBefore(i, TypePoint);
      break;
    }
  }
}

//=======================================================================
//function : Clear
//purpose  : 
//=======================================================================

void LProp_CurAndInf::Clear()
{
  theParams.Clear();
  theTypes .Clear();
}


//=======================================================================
//function : IsEmpty
//purpose  : 
//=======================================================================

Standard_Boolean LProp_CurAndInf::IsEmpty() const 
{
  return theParams.IsEmpty();
}


//=======================================================================
//function : NbPoints
//purpose  : 
//=======================================================================

Standard_Integer LProp_CurAndInf::NbPoints() const 
{
  return theParams.Length();
}


//=======================================================================
//function : Parameter
//purpose  : 
//=======================================================================

Standard_Real LProp_CurAndInf::Parameter(const Standard_Integer N) const 
{
  if (N <1 || N > NbPoints ()) {Standard_OutOfRange::Raise();}
  return theParams.Value(N);
}


//=======================================================================
//function : Type
//purpose  : 
//=======================================================================

LProp_CIType LProp_CurAndInf::Type(const Standard_Integer N) const 
{  
  if (N <1 || N > NbPoints()) {Standard_OutOfRange::Raise();}
  return theTypes.Value(N);
}