Skip to content

Implemented closest (ray, point) - #83

Open
AlchemistReturns wants to merge 1 commit into
OneLoneCoder:mainfrom
AlchemistReturns:main
Open

Implemented closest (ray, point)#83
AlchemistReturns wants to merge 1 commit into
OneLoneCoder:mainfrom
AlchemistReturns:main

Conversation

@AlchemistReturns

Copy link
Copy Markdown

closest(ray, point) (line 888) was a stub that just returned the input point unconditionally, never actually projecting onto the ray. This implements it properly: projects the point onto the ray's direction, clamped to t ≥ 0 so points "behind" the ray's origin correctly return the origin itself instead of an out-of-bounds result.

Testing:
Verified with a standalone test harness against known cases (point ahead of ray, point behind origin, point already on the ray).


This is my first open source contribution and I'd like to keep contributing. Picked this from the gaps listed for the project, happy to pick up more of the closest(...) stubs if this one looks good.

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.

1 participant