0031642: Visualization - crash in Graphic3d_Structure::SetVisual() on redisplaying...
[occt.git] / src / math / math_BracketMinimum.lxx
CommitLineData
b311480e 1// Copyright (c) 1997-1999 Matra Datavision
973c2be1 2// Copyright (c) 1999-2014 OPEN CASCADE SAS
b311480e 3//
973c2be1 4// This file is part of Open CASCADE Technology software library.
b311480e 5//
d5f74e42 6// This library is free software; you can redistribute it and/or modify it under
7// the terms of the GNU Lesser General Public License version 2.1 as published
973c2be1 8// by the Free Software Foundation, with special exception defined in the file
9// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
10// distribution for complete text of the license and disclaimer of any warranty.
b311480e 11//
973c2be1 12// Alternatively, this file may be used under the terms of Open CASCADE
13// commercial license or contractual agreement.
b311480e 14
7fd59977 15// math_BracketMinimum.lxx
16
f79b19a1 17#include <Precision.hxx>
18
19inline math_BracketMinimum::math_BracketMinimum(const Standard_Real A,
20 const Standard_Real B)
21: Done(Standard_False),
22 Ax(A), Bx(B), Cx(0.),
23 FAx(0.), FBx(0.), FCx(0.),
24 myLeft(-Precision::Infinite()),
25 myRight(Precision::Infinite()),
26 myIsLimited(Standard_False),
27 myFA(Standard_False),
28 myFB(Standard_False)
29{
30}
31
7fd59977 32inline Standard_Boolean math_BracketMinimum::IsDone() const { return Done; }
33
34inline Standard_OStream& operator<<(Standard_OStream& o,
35 const math_BracketMinimum& Br)
36{
37 Br.Dump(o);
38 return o;
39}
f79b19a1 40
41inline void math_BracketMinimum::SetLimits(const Standard_Real theLeft,
42 const Standard_Real theRight)
43{
44 myLeft = theLeft;
45 myRight = theRight;
46 myIsLimited = Standard_True;
47}
48
49inline void math_BracketMinimum::SetFA(const Standard_Real theValue)
50{
51 FAx = theValue;
52 myFA = Standard_True;
53}
54
55inline void math_BracketMinimum::SetFB(const Standard_Real theValue)
56{
57 FBx = theValue;
58 myFB = Standard_True;
59}
60
61inline Standard_Real math_BracketMinimum::Limited(const Standard_Real theValue) const
62{
63 return theValue < myLeft ? myLeft :
64 theValue > myRight ? myRight : theValue;
65}