Last active
May 9, 2023 08:31
-
-
Save joonas-yoon/038f37a11942167c695fd8c149197038 to your computer and use it in GitHub Desktop.
f(x) = [r, g, b] ; from (1, 0, 0) to (0, 1, 0) to (0, 0, 1) for 0 <= x <= 1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def vec3(x): | |
return [ | |
max(0.0, min(1.0 - 2.0*x, 1.0)), | |
abs(1.0 - abs(2.0*x - 1.0)), | |
max(0.0, min(2.0*x - 1.0, 1.0)) | |
] | |
for i in range(100+1): | |
x = i/100 | |
print(x, vec3(x)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment