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

Simplify trace_ray, remove heap mallocs #27

Merged
merged 2 commits into from
Nov 8, 2022
Merged

Simplify trace_ray, remove heap mallocs #27

merged 2 commits into from
Nov 8, 2022

Conversation

jobh
Copy link
Contributor

@jobh jobh commented Oct 31, 2022

First, thanks for a very nice and usable library.

In my effort to understand the trace_ray algorithm, I rewrote it a bit to remove explicit heap allocations. In my opinion, the result is a bit simpler, so it might be worthwhile to merge.

Briefly, the ray std::vector now stores coordinates rather than pointers to coordinate triples. A memoryview is used to alias the active/last point in ray.

It is probably a bit faster. I think there is also a slight difference in behaviour in that the endpoint itself is checked for NaN value, whereas before only the first step was checked.

@malcolmw
Copy link
Owner

malcolmw commented Nov 8, 2022

Thanks for your contributions @jobh, and I am glad you find the package useful! I am merging this for testing now.

@malcolmw malcolmw merged commit fae3b9c into malcolmw:master Nov 8, 2022
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.

None yet

2 participants