Numworks Epsilon
1.4.1
Graphing Calculator Operating System
memoized_curve_view_range.cpp
Go to the documentation of this file.
1
#include "
memoized_curve_view_range.h
"
2
#include <cmath>
3
#include <
assert.h
>
4
#include <
ion.h
>
5
6
namespace
Shared
{
7
8
MemoizedCurveViewRange::MemoizedCurveViewRange
() :
9
m_xMin(-10.0f),
10
m_xMax(10.0f),
11
m_yMin(-10.0f),
12
m_yMax(10.0f),
13
m_xGridUnit(2.0f),
14
m_yGridUnit(2.0f)
15
{
16
}
17
18
float
MemoizedCurveViewRange::xMin
() {
19
return
m_xMin
;
20
}
21
22
float
MemoizedCurveViewRange::xMax
() {
23
return
m_xMax
;
24
}
25
26
float
MemoizedCurveViewRange::yMin
() {
27
return
m_yMin
;
28
}
29
30
float
MemoizedCurveViewRange::yMax
() {
31
return
m_yMax
;
32
}
33
34
float
MemoizedCurveViewRange::xGridUnit
() {
35
return
m_xGridUnit
;
36
}
37
38
float
MemoizedCurveViewRange::yGridUnit
() {
39
return
m_yGridUnit
;
40
}
41
42
void
MemoizedCurveViewRange::setXMin
(
float
xMin) {
43
if
(
std::isnan
(
xMin
)) {
44
return
;
45
}
46
m_xMin
=
xMin
;
47
if
(
m_xMin
>=
m_xMax
) {
48
m_xMax
=
xMin
+
std::pow
(10.0f,
std::floor
(
std::log10
(
std::fabs
(
xMin
)))-1.0f);
49
}
50
m_xGridUnit
=
computeGridUnit
(
Axis::X
,
m_xMin
,
m_xMax
);
51
}
52
53
void
MemoizedCurveViewRange::setXMax
(
float
xMax) {
54
if
(
std::isnan
(
xMax
)) {
55
return
;
56
}
57
m_xMax
=
xMax
;
58
if
(
m_xMin
>=
m_xMax
) {
59
m_xMin
=
xMax
-
std::pow
(10.0f,
std::floor
(
std::log10
(
std::fabs
(
xMax
)))-1.0f);
60
}
61
m_xGridUnit
=
computeGridUnit
(
Axis::X
,
m_xMin
,
m_xMax
);
62
}
63
64
void
MemoizedCurveViewRange::setYMin
(
float
yMin) {
65
if
(
std::isnan
(
yMin
)) {
66
return
;
67
}
68
m_yMin
=
yMin
;
69
if
(
m_yMin
>=
m_yMax
) {
70
m_yMax
=
yMin
+
std::pow
(10.0f,
std::floor
(
std::log10
(
std::fabs
(
yMin
)))-1.0f);
71
}
72
m_yGridUnit
=
computeGridUnit
(
Axis::Y
,
m_yMin
,
m_yMax
);
73
}
74
75
void
MemoizedCurveViewRange::setYMax
(
float
yMax) {
76
if
(
std::isnan
(
yMax
)) {
77
return
;
78
}
79
m_yMax
=
yMax
;
80
if
(
m_yMin
>=
m_yMax
) {
81
m_yMin
=
yMax
- +
std::pow
(10.0f,
std::floor
(
std::log10
(
std::fabs
(
yMax
)))-1.0f);
82
83
}
84
m_yGridUnit
=
computeGridUnit
(
Axis::Y
,
m_yMin
,
m_yMax
);
85
}
86
87
}
Shared::MemoizedCurveViewRange::m_yGridUnit
float m_yGridUnit
Definition:
memoized_curve_view_range.h:30
Shared::MemoizedCurveViewRange::xMax
float xMax() override
Definition:
memoized_curve_view_range.cpp:22
Shared
Definition:
banner_view.cpp:5
Shared::MemoizedCurveViewRange::setYMax
virtual void setYMax(float f)
Definition:
memoized_curve_view_range.cpp:75
ion.h
Shared::MemoizedCurveViewRange::xMin
float xMin() override
Definition:
memoized_curve_view_range.cpp:18
Shared::MemoizedCurveViewRange::yMax
float yMax() override
Definition:
memoized_curve_view_range.cpp:30
Shared::CurveViewRange::Axis::X
fabs
#define fabs(x)
Definition:
math.h:178
Shared::MemoizedCurveViewRange::xGridUnit
float xGridUnit() override
Definition:
memoized_curve_view_range.cpp:34
assert.h
Shared::MemoizedCurveViewRange::yMin
float yMin() override
Definition:
memoized_curve_view_range.cpp:26
Shared::MemoizedCurveViewRange::m_yMax
float m_yMax
Definition:
memoized_curve_view_range.h:28
Shared::MemoizedCurveViewRange::m_xMax
float m_xMax
Definition:
memoized_curve_view_range.h:26
pow
#define pow(x, y)
Definition:
math.h:190
log10
#define log10(x)
Definition:
math.h:186
Shared::MemoizedCurveViewRange::m_yMin
float m_yMin
Definition:
memoized_curve_view_range.h:27
isnan
#define isnan(x)
Definition:
math.h:43
Shared::MemoizedCurveViewRange::m_xMin
float m_xMin
Definition:
memoized_curve_view_range.h:25
Shared::MemoizedCurveViewRange::yGridUnit
float yGridUnit() override
Definition:
memoized_curve_view_range.cpp:38
Shared::MemoizedCurveViewRange::MemoizedCurveViewRange
MemoizedCurveViewRange()
Definition:
memoized_curve_view_range.cpp:8
Shared::CurveViewRange::computeGridUnit
float computeGridUnit(Axis axis, float min, float max)
Definition:
curve_view_range.cpp:21
Shared::MemoizedCurveViewRange::setYMin
virtual void setYMin(float f)
Definition:
memoized_curve_view_range.cpp:64
Shared::CurveViewRange::Axis::Y
Shared::MemoizedCurveViewRange::m_xGridUnit
float m_xGridUnit
Definition:
memoized_curve_view_range.h:29
Shared::MemoizedCurveViewRange::setXMin
virtual void setXMin(float f)
Definition:
memoized_curve_view_range.cpp:42
Shared::MemoizedCurveViewRange::setXMax
virtual void setXMax(float f)
Definition:
memoized_curve_view_range.cpp:53
floor
#define floor(x)
Definition:
math.h:179
memoized_curve_view_range.h
epsilon
apps
shared
memoized_curve_view_range.cpp
Generated by
1.8.14