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

Fix Line2 Raycasting bounds margin computation to support Orthographic Camera #22791

Merged
merged 3 commits into from
Nov 7, 2021

Conversation

gkjohnson
Copy link
Collaborator

@gkjohnson gkjohnson commented Nov 5, 2021

Related issue: #22782

Description

This PR adjusts the logic for computing the margin for the sphere and box bounds around Line2 to correctly (I believe) determine the world-space width of the thickness of the line at the closest point on the bounding sphere / box.

The logic for computing the margin is now encapsulated in getWorldSpaceHalfWidth. It now transforms a point at the given distance into clip space, adjusts the point by the pixel width / resolution, then transforms back into world space and returns the max of the xy values as the margin. Tested by copying the jsfiddle of the above issue into one of the fat_lines three.js example pages for local dev.

@nkallen can you test this?

cc @WestLangley

@mrdoob mrdoob added this to the r135 milestone Nov 5, 2021
@mrdoob
Copy link
Owner

mrdoob commented Nov 5, 2021

@WestLangley Looks good?

@nkallen
Copy link
Contributor

nkallen commented Nov 6, 2021

I checked out this branch in my own codebase and the new behavior is good.

@WestLangley
Copy link
Collaborator

@WestLangley Looks good?

I trust @gkjohnson on this feature. :-)

@mrdoob mrdoob merged commit 6784353 into mrdoob:dev Nov 7, 2021
@mrdoob
Copy link
Owner

mrdoob commented Nov 7, 2021

Thanks!

@gkjohnson gkjohnson deleted the line2-raycast-fix branch November 8, 2021 00:19
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.

4 participants