Skip to content

Commit

Permalink
Do unit transform on path elements before DP scale/bias
Browse files Browse the repository at this point in the history
This is a big commit.  It fixes an issue with DP scale/biasing
a value that also undergoes temperature unit conversion (non-zero bias!).
Prior to this commit, the unit scale and bias were applied via
the painter transform. That's not possible for Celsius to
Farenheit if DP scaling/biasing.  This commit moves the
unit transform so that it applies the unit conversion
first to the painter path elements and then, later, the
DP scale/bias transform is done in the painter transform.

Here is an example:

   let temperature = 100C
   If DP scales by 2.0 and biases by 10 and sets unit to F:
       2*((9/5)*100C + 32) + 10 = 2*212+32 = 434
   or
       y = (9/5)*100C+32  // Unit transform
       y = 2*y+10         // DP scale
       y = 2*212+10 = 434

Prior to this fix, the scales and biases were applied like:

   y != 2*(9/5)*(100C) + (32+10)  // scaling and biasing independently
     != 360+42 = 402
   which is wrong wrong wrong!
  • Loading branch information
keithvetter committed Nov 22, 2024
1 parent 4355031 commit 7c449a2
Show file tree
Hide file tree
Showing 7 changed files with 377 additions and 164 deletions.
Loading

0 comments on commit 7c449a2

Please sign in to comment.