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

what is dda_unit doing? #24

Open
brabbitdousha opened this issue Apr 6, 2023 · 1 comment
Open

what is dda_unit doing? #24

brabbitdousha opened this issue Apr 6, 2023 · 1 comment

Comments

@brabbitdousha
Copy link

void dda_unit(vec3 cen, vec3 invdir, out float tmax) {
    float t1, t2;
    tmax = 1e9f;
    for (int i = 0; i < 3; ++i) {
        t1 = - cen[i] * invdir[i];
        t2 = t1 +  invdir[i];
        tmax = min(tmax, max(t1, t2));
    }
}

I may have trouble understanding it...could you help me..many thanks!..
It looks like the t1 is trying to go back to the origin...

@liaohuanxuan
Copy link

I had the same question. Do you understand?

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

No branches or pull requests

2 participants