mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
[interactive_curve_view_range] Force equal axes
Added a tolerance when checking orthonormality, so that ranges that are nearly orthonormal will be made orthonormal. Change-Id: Ie3bf076086561e3ff6374e7daa9dd1a884c52d5a
This commit is contained in:
committed by
Émilie Feral
parent
482ca10363
commit
8ce9f363ad
@@ -115,7 +115,7 @@ void InteractiveCurveViewRange::setDefault() {
|
||||
|
||||
// Compute the interesting range
|
||||
m_delegate->interestingRanges(this);
|
||||
bool revertToNormalized = isOrthonormal();
|
||||
bool revertToNormalized = isOrthonormal(k_orthonormalTolerance);
|
||||
|
||||
// Add margins
|
||||
float xRange = xMax() - xMin();
|
||||
@@ -198,8 +198,8 @@ void InteractiveCurveViewRange::checkForNormalizedRange() {
|
||||
}
|
||||
|
||||
bool InteractiveCurveViewRange::isOrthonormal(float tolerance) const {
|
||||
float pixelHeight = std::round(Ion::Display::Height * (NormalizedYHalfRange(100.f) / Ion::Display::HeightInTenthOfMillimeter));
|
||||
float pixelWidth = std::round(Ion::Display::Width * (NormalizedXHalfRange(100.f) / Ion::Display::WidthInTenthOfMillimeter));
|
||||
return std::fabs(std::round(pixelHeight * (xMax() - xMin())) - std::round(pixelWidth * (yMax() - yMin()))) <= tolerance;
|
||||
float ratio = (yMax() - yMin()) / (xMax() - xMin());
|
||||
float ratioDifference = std::fabs(std::log(ratio / NormalYXRatio()));
|
||||
return ratioDifference <= tolerance;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user