Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

25
LINES

< > BotCompany Repo | #1032084 // transformBetweenDoubleRanges_verbose

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (3283L/18K).

static double transformBetweenDoubleRanges_verbose(double x, double srcStart, double srcEnd, double destStart, double destEnd) {
  ret transformBetweenDoubleRanges_verbose(x, doubleRange(srcStart, srcEnd), doubleRange(destStart, destEnd));
}

static double transformBetweenDoubleRanges_verbose(double x, DoubleRange src, DoubleRange dest) {
  double x2 = x-src.start;
  double srcL = src.length();
  double x3 = doubleRatio(x2, srcL);
  double destL = dest.length();
  double y1 = destL*x3;
  double y2 = dest.start+y1;
  printVars transformBetweenDoubleRanges_verbose(
    +x, +src, +dest, +x2, +srcL, +x3, +destL, +y1, +y2);
  
  ret y2;
}

static DoubleRange transformBetweenDoubleRanges_verbose(DoubleRange r, DoubleRange src, DoubleRange dest) {
  if (r == null) null;
  double a = transformBetweenDoubleRanges_verbose(r.start, src, dest);
  double b = transformBetweenDoubleRanges_verbose(r.end, src, dest);
  var rr = DoubleRange(a, b);
  printVars transformBetweenDoubleRanges_verbose(+r, +src, +dest, +rr);
  ret rr;
}

Author comment

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: 156 / 224
Version history: 2 change(s)
Referenced in: [show references]