mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
[libaxx] add cmath and use cmath instead of math.h when required
Change-Id: Id839b17d33c69e2e002f370e553ff35246a1bc90
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
#include "interactive_curve_view_range.h"
|
||||
#include <poincare.h>
|
||||
#include <ion.h>
|
||||
#include <math.h>
|
||||
#include <cmath>
|
||||
#include <stddef.h>
|
||||
#include <assert.h>
|
||||
|
||||
@@ -90,7 +90,7 @@ void InteractiveCurveViewRange::zoom(float ratio, float x, float y) {
|
||||
float xMax = m_xMax;
|
||||
float yMin = m_yMin;
|
||||
float yMax = m_yMax;
|
||||
if (ratio*fabsf(xMax-xMin) < k_minFloat || ratio*fabsf(yMax-yMin) < k_minFloat) {
|
||||
if (ratio*std::fabs(xMax-xMin) < k_minFloat || ratio*std::fabs(yMax-yMin) < k_minFloat) {
|
||||
return;
|
||||
}
|
||||
float newXMin = clipped(x*(1.0f-ratio)+ratio*xMin, false);
|
||||
@@ -122,8 +122,8 @@ void InteractiveCurveViewRange::panWithVector(float x, float y) {
|
||||
void InteractiveCurveViewRange::roundAbscissa() {
|
||||
float xMin = m_xMin;
|
||||
float xMax = m_xMax;
|
||||
float newXMin = clipped(roundf((xMin+xMax)/2) - (float)Ion::Display::Width/2.0f, false);
|
||||
float newXMax = clipped(roundf((xMin+xMax)/2) + (float)Ion::Display::Width/2.0f-1.0f, true);
|
||||
float newXMin = clipped(std::round((xMin+xMax)/2) - (float)Ion::Display::Width/2.0f, false);
|
||||
float newXMax = clipped(std::round((xMin+xMax)/2) + (float)Ion::Display::Width/2.0f-1.0f, true);
|
||||
if (isnan(newXMin) || isnan(newXMax)) {
|
||||
return;
|
||||
}
|
||||
@@ -178,16 +178,16 @@ void InteractiveCurveViewRange::centerAxisAround(Axis axis, float position) {
|
||||
}
|
||||
if (axis == Axis::X) {
|
||||
float range = m_xMax - m_xMin;
|
||||
if (fabsf(position/range) > k_maxRatioPositionRange) {
|
||||
range = powf(10.0f, floorf(log10f(fabsf(position)))-1.0f);
|
||||
if (std::fabs(position/range) > k_maxRatioPositionRange) {
|
||||
range = std::pow(10.0f, std::floor(std::log10(std::fabs(position)))-1.0f);
|
||||
}
|
||||
m_xMax = clipped(position + range/2.0f, true);
|
||||
MemoizedCurveViewRange::setXMin(clipped(position - range/2.0f, false));
|
||||
} else {
|
||||
m_yAuto = false;
|
||||
float range = m_yMax - m_yMin;
|
||||
if (fabsf(position/range) > k_maxRatioPositionRange) {
|
||||
range = powf(10.0f, floorf(log10f(fabsf(position)))-1.0f);
|
||||
if (std::fabs(position/range) > k_maxRatioPositionRange) {
|
||||
range = std::pow(10.0f, std::floor(std::log10(std::fabs(position)))-1.0f);
|
||||
}
|
||||
m_yMax = clipped(position + range/2.0f, true);
|
||||
MemoizedCurveViewRange::setYMin(clipped(position - range/2.0f, false));
|
||||
|
||||
Reference in New Issue
Block a user