Skip to content
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

tcksample: Ability to sample SH amplitudes #3028

Draft
wants to merge 1 commit into
base: tcksample_4d
Choose a base branch
from

Conversation

Lestropie
Copy link
Member

Closes #2942.

  • Restructure code to make better use of templating.
    The input being a 4D SH should perhaps be a derived class, which instantiates the precomputer and has a local buffer for loading SH coefficients from the image.

  • Add test data and tests.

@Lestropie Lestropie self-assigned this Oct 24, 2024
@Lestropie Lestropie marked this pull request as draft October 24, 2024 02:02
if (interp.scanner (tck[i])) {
for (interp.index(3) = 0; interp.index(3) != interp.size(3); ++interp.index(3))
sh_coeffs[interp.index(3)] = interp.value();
const Eigen::Vector3f dir = (tck[(i == ssize_t(tck.size()-1)) ? i : (i+1)] - tck[i ? (i-1) : 0]).normalized();
Copy link
Member

@daljit46 daljit46 Oct 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps std::clamp conveys the intention slightly better here? Something like:

const Eigen::Vector3f dir = (tck[std::clamp(i + 1, size_t(0), tck.size() - 1)] - tck[std::clamp(i - 1, size_t(0), tck.size() - 1)]).normalized();

Although for the second index, your current version is probably fine already.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will need to reprogram my brain to be accustomed to having that one available. However the base for this branch is pre-cmake and so pre-C++17.
(This particular calculation would also be better handled via #2189)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants