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).

1  
static double transformBetweenDoubleRanges(double x, DoubleRange src, DoubleRange dest) {
2  
  ret dest.start+dest.length()*doubleRatio(x-src.start, src.length());
3  
}
4  
5  
static DoubleRange transformBetweenDoubleRanges(DoubleRange r, DoubleRange src, DoubleRange dest) {
6  
  ret r == null ?:
7  
    DoubleRange(transformBetweenDoubleRanges(r.start, src, dest),
8  
      transformBetweenDoubleRanges(r.end, src, dest));
9  
}

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