From 684bb2ca507cb1eae449ab1a906d280b85857dbc Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Fri, 18 Sep 2026 19:51:57 +0200 Subject: [PATCH] Parameters: draft the cases of a generic feed-join In the general case, a base value and a feed can also be combined when the metric of both arguments differs; notably a linear multiplier can be applied to an logarithmic base value by adding its logarithm, and a logarithmic feed can be multiplied to a linear base value by taking the exponential function. Furthermore there are some cases involving nominal scales, which we can mark only, but leave unimplemented --- src/lib/par/scale.hpp | 64 ++++++++++++++++++++++++++++++++++++++-- wiki/thinkPad.ichthyo.mm | 51 ++++++++++++++++++++++++++++---- 2 files changed, 107 insertions(+), 8 deletions(-) diff --git a/src/lib/par/scale.hpp b/src/lib/par/scale.hpp index 0a31f0f55..48da2451c 100644 --- a/src/lib/par/scale.hpp +++ b/src/lib/par/scale.hpp @@ -87,6 +87,16 @@ namespace par { template VAL join (VAL const&, SRC const&, Scale const&) const; VAL join (VAL const&, VAL const&) const; + + private: + template + VAL asFactor (VAL const&) const; + + template + VAL baseScale (Metric targetMetric) const; + + template + VAL asLogarithm (Metric targetMetric, VAL const&) const; }; @@ -195,8 +205,34 @@ namespace par { inline VAL Scale::join (VAL const& value, SRC const& srcFeed, Scale const& feedScale) const { - VAL feed(preClamp (srcFeed)); - return join (value, feed); + VAL res{}; + if (NOM == metric) + UNIMPLEMENTED ("nominal and ordinal scales"); + if (LIN == metric) + { + if (feedScale.isLogarithmic()) + assignConverted (res, value * feedScale.template asFactor (srcFeed)); + else + if (this->isFactor()) + assignConverted (res, value * srcFeed); + else + assignConverted (res, value + srcFeed); + } + else + if (this->isLogarithmic()) + { + if (feedScale.isLogarithmic()) + assignConverted (res, value + feedScale.template baseScale(metric) * srcFeed); + else + if (feedScale.isFactor()) + assignConverted (res, value + feedScale.template asLogarithm (metric, srcFeed)); + else + throw err::Invalid {"adding a non-logarithmic data feed on top of a logarithmic base value is pointless."}; + } + else + NOTREACHED ("Unexpected metric conversion case"); + + return conform (res); } /** @@ -211,6 +247,30 @@ namespace par { ); } + template + template + inline VAL + Scale::asFactor (VAL const& value) const + { + UNIMPLEMENTED ("transform a logarithmic value into an exponential factor"); + } + + template + template + inline VAL + Scale::baseScale (Metric targetMetric) const + { + UNIMPLEMENTED ("provide the adaptation factor from this logarithmic scale to the given other logarithmic scale"); + } + + template + template + inline VAL + Scale::asLogarithm (Metric targetMetric, VAL const& value) const + { + UNIMPLEMENTED ("transform this value into a suitable logarithm for the target scale"); + } + }} // namespace lib::par #endif /*LIB_PAR_SCALE_H*/ diff --git a/wiki/thinkPad.ichthyo.mm b/wiki/thinkPad.ichthyo.mm index d71bdc78f..e9785a1d7 100644 --- a/wiki/thinkPad.ichthyo.mm +++ b/wiki/thinkPad.ichthyo.mm @@ -85612,10 +85612,9 @@ - - + + - @@ -85641,9 +85640,49 @@ - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+ d.h. wenn beide Seiten float sind, dann ist das wohl auch so beabsichtigt, und wir bleiben in der float-Domäne. Ebenso wenn eine Seite long-double ist, dann alles dort. Sonst double verwenden +

+ + +
+
+
+ + + +