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

9
LINES

< > BotCompany Repo | #1031928 // transformBetweenDoubleRanges

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

Libraryless. Click here for Pure Java version (3125L/17K).

static double transformBetweenDoubleRanges(double x, DoubleRange src, DoubleRange dest) {
  ret dest.start+dest.length()*doubleRatio(x-src.start, src.length());
}

static DoubleRange transformBetweenDoubleRanges(DoubleRange r, DoubleRange src, DoubleRange dest) {
  ret r == null ?:
    DoubleRange(transformBetweenDoubleRanges(r.start, src, dest),
      transformBetweenDoubleRanges(r.end, src, dest));
}

download  show line numbers  debug dex  old transpilations   

Travelled to 3 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx

No comments. add comment

Snippet ID: #1031928
Snippet name: transformBetweenDoubleRanges
Eternal ID of this version: #1031928/3
Text MD5: 09d4de5b816ff62f5127bbcdfa3cec02
Transpilation MD5: 0468751af2b9d310a60c8eda3ccc4456
Author: stefan
Category: javax / maths
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-08-02 04:36:55
Source code size: 413 bytes / 9 lines
Pitched / IR pitched: No / No
Views / Downloads: 177 / 250
Version history: 2 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1032084 - transformBetweenDoubleRanges_verbose
#1032086 - transformToZeroToOne