Numworks Epsilon  1.4.1
Graphing Calculator Operating System
curve_view_cursor.cpp
Go to the documentation of this file.
1 #include "curve_view_cursor.h"
2 #include <cmath>
3 
4 namespace Shared {
5 
7  m_x(NAN),
8  m_y(NAN)
9 {
10 }
11 
13  return m_x;
14 }
15 
17  return m_y;
18 }
19 
20 void CurveViewCursor::moveTo(double x, double y) {
21  m_x = clipped(x, false);
22  m_y = clipped(y, true);
23 }
24 
25 double CurveViewCursor::clipped(double x, bool canBeInfinite) {
26  double maxValue = canBeInfinite ? INFINITY : k_maxFloat;
27  double clippedX = x > k_maxFloat ? maxValue : x;
28  clippedX = clippedX < - k_maxFloat ? -maxValue : clippedX;
29  return clippedX;
30 }
31 
32 }
#define NAN
Definition: math.h:30
void moveTo(double x, double y)
#define INFINITY
Definition: math.h:29