mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-23 07:40:42 +01:00
[apps/calculation] additional_outputs; fix range of ComplexGraphView
This commit is contained in:
@@ -8,28 +8,34 @@ ComplexModel::ComplexModel(std::complex<float> c) :
|
||||
{
|
||||
}
|
||||
|
||||
float rangeBound(float value, float direction) {
|
||||
float rangeBound(float value, float direction, bool horizontal) {
|
||||
if (std::isnan(value) || std::isinf(value) || value == 0.0f) {
|
||||
return direction;
|
||||
}
|
||||
float factor = direction*value >= 0.0f ? 1.2f : -0.3f;
|
||||
float minFactor = -0.5f;
|
||||
float maxFactor = 1.2f;
|
||||
if (horizontal) {
|
||||
minFactor = -1.0f;
|
||||
maxFactor = 2.0f;
|
||||
}
|
||||
float factor = direction*value >= 0.0f ? maxFactor : minFactor;
|
||||
return factor*value;
|
||||
}
|
||||
|
||||
float ComplexModel::xMin() const {
|
||||
return rangeBound(real(), -1.0f);
|
||||
return rangeBound(real(), -1.0f, true);
|
||||
}
|
||||
|
||||
float ComplexModel::xMax() const {
|
||||
return rangeBound(real(), 1.0f);
|
||||
return rangeBound(real(), 1.0f, true);
|
||||
}
|
||||
|
||||
float ComplexModel::yMin() const {
|
||||
return rangeBound(imag(), -1.0f);
|
||||
return rangeBound(imag(), -1.0f, false);
|
||||
}
|
||||
|
||||
float ComplexModel::yMax() const {
|
||||
return rangeBound(imag(), 1.0f);
|
||||
return rangeBound(imag(), 1.0f, false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user