Libraryless. Click here for Pure Java version (3283L/18K).
1 | static double transformBetweenDoubleRanges_verbose(double x, double srcStart, double srcEnd, double destStart, double destEnd) { |
2 | ret transformBetweenDoubleRanges_verbose(x, doubleRange(srcStart, srcEnd), doubleRange(destStart, destEnd)); |
3 | } |
4 | |
5 | static double transformBetweenDoubleRanges_verbose(double x, DoubleRange src, DoubleRange dest) { |
6 | double x2 = x-src.start; |
7 | double srcL = src.length(); |
8 | double x3 = doubleRatio(x2, srcL); |
9 | double destL = dest.length(); |
10 | double y1 = destL*x3; |
11 | double y2 = dest.start+y1; |
12 | printVars transformBetweenDoubleRanges_verbose( |
13 | +x, +src, +dest, +x2, +srcL, +x3, +destL, +y1, +y2); |
14 | |
15 | ret y2; |
16 | } |
17 | |
18 | static DoubleRange transformBetweenDoubleRanges_verbose(DoubleRange r, DoubleRange src, DoubleRange dest) { |
19 | if (r == null) null; |
20 | double a = transformBetweenDoubleRanges_verbose(r.start, src, dest); |
21 | double b = transformBetweenDoubleRanges_verbose(r.end, src, dest); |
22 | var rr = DoubleRange(a, b); |
23 | printVars transformBetweenDoubleRanges_verbose(+r, +src, +dest, +rr); |
24 | ret rr; |
25 | } |
Began life as a copy of #1031928
download show line numbers debug dex old transpilations
Travelled to 3 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx
No comments. add comment
Snippet ID: | #1032084 |
Snippet name: | transformBetweenDoubleRanges_verbose |
Eternal ID of this version: | #1032084/3 |
Text MD5: | 9afde9c60f35709313cf875ae6de0c0d |
Transpilation MD5: | 41bdfd5d3556be9375ca190458ebb003 |
Author: | stefan |
Category: | javax / maths |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2021-08-11 13:47:17 |
Source code size: | 1051 bytes / 25 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 157 / 226 |
Version history: | 2 change(s) |
Referenced in: | [show references] |