-
Notifications
You must be signed in to change notification settings - Fork 377
Draft: remap implementation in std library #1955
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Draft: remap implementation in std library #1955
Conversation
Are you planning to come back and finish this? |
I've been trying to attend one of the TSC meetings to ask these questions regarding the implementation, but there's often a overlap with a class in university. I'll send the questions posted in the slack channel in case anyone's suggestions there would be of help. For the time being, I'll try getting a remap implementation working as described in the initial issue, and from there can add to this PR other compiler optimizations mentioned in the discussion. |
Please note also that I just merged a PR that removed the .tex files for the old LaTeX documentation, which is no longer used. The right place to document library functions like this are in src/doc/stdlib.md. Feel free to ask questions on the slack, on the mail list, or here in the discussion for your PR. Especially if you have schedule conflicts, there isn't really any need to come to the biweekly meetings just to ask a small question about the code (in fact, questions about code are almost always better asked as text rather than voice, where it's hard to pose exact problems and give code solutions by just talking). |
37ca986
to
91c9bb0
Compare
Signed-off-by: Sparsh-N <[email protected]>
91c9bb0
to
1fd4c56
Compare
Signed-off-by: Sparsh-N <[email protected]>
#if 0 // Assuming x != y | ||
normal unmix (normal x, normal y, normal a) { return (a - x) / (y - x); } | ||
normal unmix (normal x, normal y, float a) { return (a - x) / (y - x); } | ||
vector unmix (vector x, vector y, vector a) { return (a - x) / (y - x); } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would just keep these definitions where it's implemented in OSL, and remove the ones where it's marked BUILTIN (which is a lot more work for you to implement, with little evidence so far that it would be helpful).
Also, you don't need to assume x != y, division by zero is defined to be safe in OSL. (It may be nonsensical to call unmix under such conditions, however, but you get what you deserve if you do so.)
Description
Work in progress PR. Aims to resolve #1899
Some questions I have regarding implementing it are:
Thanks!
[Update]
I'll be keeping a changelog of the issue here as I go along with it. So far, I've implemented a inverseLerp/unmix method, although there's some changes missing. I'll get unmix working with tests before moving onto the full remap() implementation.
Tests
Haven't added any tests currently, will add more once the method is complete. To my understanding the tests would be in
/testsuite/remap-reg folder
Checklist:
already run clang-format v17 before submitting, I definitely will look at
the CI test that runs clang-format and fix anything that it highlights as
being nonconforming.