[poincare/Coordinate2D] Template for double or float

This commit is contained in:
Léa Saviot
2019-08-28 11:20:38 +02:00
parent 22dd9752a5
commit a15bc53e06
18 changed files with 104 additions and 103 deletions

View File

@@ -19,7 +19,7 @@ CalculationGraphController::CalculationGraphController(Responder * parentRespond
void CalculationGraphController::viewWillAppear() {
assert(!m_record.isNull());
Coordinate2D pointOfInterest = computeNewPointOfInteresetFromAbscissa(m_graphRange->xMin(), 1);
Coordinate2D<double> pointOfInterest = computeNewPointOfInteresetFromAbscissa(m_graphRange->xMin(), 1);
if (std::isnan(pointOfInterest.abscissa())) {
m_isActive = false;
m_graphView->setCursorView(nullptr);
@@ -44,7 +44,7 @@ void CalculationGraphController::reloadBannerView() {
reloadBannerViewForCursorOnFunction(m_cursor, m_record, functionStore());
}
Coordinate2D CalculationGraphController::computeNewPointOfInteresetFromAbscissa(double start, int direction) {
Coordinate2D<double> CalculationGraphController::computeNewPointOfInteresetFromAbscissa(double start, int direction) {
double step = m_graphRange->xGridUnit()/10.0;
step = direction < 0 ? -step : step;
double max = direction > 0 ? m_graphRange->xMax() : m_graphRange->xMin();
@@ -69,7 +69,7 @@ bool CalculationGraphController::handleEnter() {
}
bool CalculationGraphController::moveCursorHorizontally(int direction) {
Coordinate2D newPointOfInterest = computeNewPointOfInteresetFromAbscissa(m_cursor->x(), direction);
Coordinate2D<double> newPointOfInterest = computeNewPointOfInteresetFromAbscissa(m_cursor->x(), direction);
if (std::isnan(newPointOfInterest.abscissa())) {
return false;
}