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

vectorize the function that check triangle intersection #93

Merged
merged 5 commits into from
Feb 6, 2024

Conversation

yaio4109
Copy link
Contributor

@yaio4109 yaio4109 commented Feb 4, 2024

When i use latest version of odak code, the function checking triangle intersection can only check one triangle at a time. So if i try to check a lot of triangle intersections, i need to loop through the triangles, which is slow in Python. Therefore, I rewrote the code associating with triangle intersection in vectorization form.

@kaanaksit
Copy link
Owner

Thank you, @yaio4109, for improving odak. Please note that once we have your updates, it will appear in the next stable version, which is 0.2.6. Could you please verify and help me to improve following so that I can merge your updates with the origin/master:

  • Please verify that your name is Wu Jia-Lun. If so, could you please update THANKS.txt, and add your name using alphabetical order. Could you please also add your name and Orcid ID to CITATION.cff?
  • Please also add a unit test to our test folder as test/test_learn_ray_intersect_w_triangle_batch.py. Please get inspired from an existing unit test in the process, closest unit test example is test/test_learn_ray_intersect_w_a_triangle.py.

@@ -220,7 +255,7 @@ def intersect_w_surface(ray, points):
normal = get_triangle_normal(points)
if len(ray.shape) == 2:
ray = ray.unsqueeze(0)
if len(points) == 2:
if len(points.shape) == 2:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

It should be the tensor shape, not the length of tensor. I also fix same bug in "raytracing" module.

@yaio4109
Copy link
Contributor Author

yaio4109 commented Feb 6, 2024

I add my name Wu Jialun to the THANKS.txt and CITATION.cff, and add the unit test for intersect_w_triangle_batch. When i write the unit test, i found that the function intersect_w_surface should check the shape of points not the length of points.

If having other issue, please let me know. 🤗

@kaanaksit kaanaksit merged commit 0c1c3bc into kaanaksit:master Feb 6, 2024
@kaanaksit
Copy link
Owner

kaanaksit commented Feb 6, 2024

Thank you very much, @yaio4109, for your contributions to odak. I have reviewed and merged your edits. They should now be available in the repository. Your functions will become available to other users installing odak using pip in the next version, 0.2.6.

I hope to be able to meet in-person one day, and please to meet you virtually!

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

Successfully merging this pull request may close these issues.

2 participants