mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-18 16:27:34 +01:00
[apps/curve_view_cursor] t member
This commit is contained in:
@@ -3,22 +3,23 @@
|
|||||||
|
|
||||||
namespace Shared {
|
namespace Shared {
|
||||||
|
|
||||||
CurveViewCursor::CurveViewCursor() :
|
CurveViewCursor::CurveViewCursor() : m_t(NAN), m_x(NAN), m_y(NAN) {}
|
||||||
m_x(NAN),
|
|
||||||
m_y(NAN)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void CurveViewCursor::moveTo(double x, double y) {
|
void CurveViewCursor::moveTo(double t, double x, double y) {
|
||||||
m_x = clipped(x, false);
|
m_t = clipped(t, false);
|
||||||
|
m_x = clipped(x, false); //TODO LEA ?
|
||||||
m_y = clipped(y, true);
|
m_y = clipped(y, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
double CurveViewCursor::clipped(double x, bool canBeInfinite) {
|
double CurveViewCursor::clipped(double x, bool canBeInfinite) {
|
||||||
double maxValue = canBeInfinite ? INFINITY : k_maxFloat;
|
double maxValue = canBeInfinite ? INFINITY : k_maxFloat;
|
||||||
double clippedX = x > k_maxFloat ? maxValue : x;
|
if (x > k_maxFloat) {
|
||||||
clippedX = clippedX < - k_maxFloat ? -maxValue : clippedX;
|
return maxValue;
|
||||||
return clippedX;
|
}
|
||||||
|
if (x < -k_maxFloat) {
|
||||||
|
return -maxValue;
|
||||||
|
}
|
||||||
|
return x;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,12 +6,14 @@ namespace Shared {
|
|||||||
class CurveViewCursor {
|
class CurveViewCursor {
|
||||||
public:
|
public:
|
||||||
CurveViewCursor();
|
CurveViewCursor();
|
||||||
|
double t() const { return m_t; }
|
||||||
double x() const { return m_x; }
|
double x() const { return m_x; }
|
||||||
double y() const { return m_y; }
|
double y() const { return m_y; }
|
||||||
void moveTo(double x, double y);
|
void moveTo(double t, double x, double y);
|
||||||
private:
|
private:
|
||||||
static double clipped(double f, bool canBeInfinite);
|
static double clipped(double f, bool canBeInfinite);
|
||||||
constexpr static double k_maxFloat = 1E+8;
|
constexpr static double k_maxFloat = 1E+8;
|
||||||
|
double m_t;
|
||||||
double m_x;
|
double m_x;
|
||||||
double m_y;
|
double m_y;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user