| OLD | NEW |
| 1 // | 1 // |
| 2 // Copyright 2014 Google Inc. All rights reserved. | 2 // Copyright 2014 Google Inc. All rights reserved. |
| 3 // | 3 // |
| 4 // Use of this source code is governed by a BSD-style | 4 // Use of this source code is governed by a BSD-style |
| 5 // license that can be found in the LICENSE file or at | 5 // license that can be found in the LICENSE file or at |
| 6 // https://developers.google.com/open-source/licenses/bsd | 6 // https://developers.google.com/open-source/licenses/bsd |
| 7 // | 7 // |
| 8 | 8 |
| 9 part of charted.core.interpolators; | 9 part of charted.core.interpolators; |
| 10 | 10 |
| (...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 383 Interpolator uninterpolateNumber(num a, num b) { | 383 Interpolator uninterpolateNumber(num a, num b) { |
| 384 b = 1 / (b - a); | 384 b = 1 / (b - a); |
| 385 return (x) => (x - a) * b; | 385 return (x) => (x - a) * b; |
| 386 } | 386 } |
| 387 | 387 |
| 388 /// Reverse interpolator for a clamped number. | 388 /// Reverse interpolator for a clamped number. |
| 389 Interpolator uninterpolateClamp(num a, num b) { | 389 Interpolator uninterpolateClamp(num a, num b) { |
| 390 b = 1 / (b - a); | 390 b = 1 / (b - a); |
| 391 return (x) => math.max(0, math.min(1, (x - a) * b)); | 391 return (x) => math.max(0, math.min(1, (x - a) * b)); |
| 392 } | 392 } |
| OLD | NEW |