Merge: math: Intro `Comparable::clamp`
authorJean Privat <jean@pryen.org>
Mon, 27 Jun 2016 21:58:42 +0000 (17:58 -0400)
committerJean Privat <jean@pryen.org>
Mon, 27 Jun 2016 21:58:42 +0000 (17:58 -0400)
commitd5b444a7e8309fee33423ec6bb6f580052b9d286
treeb1a4f270615cc9b2f9bc0576bf1d6e6b64718c81
parent78857fd1d59ed7c3b0ba41f953e8c3fe89de0cfa
parentbd31bc129fe058ed860c6c0f9ff1c759476ca784
Merge: math: Intro `Comparable::clamp`

The `clamp` service restricts a value within a given range. It is a common service in GLSL and it is especially useful for games. Even though the alternative is short: `x = x.min(1.0).max(0.0)`, it is quite confusing and the simple `x = x.clamp(0.0, 1.0)` is easier to read.

Pull-Request: #2207
Reviewed-by: Jean Privat <jean@pryen.org>
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>