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

check points for distance instead #101

Merged
merged 3 commits into from
Jun 19, 2024
Merged

check points for distance instead #101

merged 3 commits into from
Jun 19, 2024

Conversation

jamesbradleym
Copy link
Contributor

@jamesbradleym jamesbradleym commented Jun 12, 2024

Evidently using the distance from one line to another was not sufficient to determine if projection was needed. This PR compares the end points of the lines for to determine if they are within tolerance, but further than epsilon, and thus needs projection.


This change is Reviewable

Copy link
Member

@wynged wynged left a comment

Choose a reason for hiding this comment

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

Reviewed all commit messages.
Reviewable status: 1 change requests, 0 of 1 approvals obtained, 1 unresolved discussion (waiting on @jamesbradleym)


LayoutFunctions/WallsLOD200/src/WallsLOD200.cs line 128 at r1 (raw file):

                            {
                                // project lines with points within tolerance of eachother but further than epsilon
                                if (LinesWithinTolerance(line, otherLine, tolerance))

I'm having trouble figuring what we've fundamentally changed and be sure we're not discarding something we might want to join.

like, what if there are two lines that overlap where the overlap is greater than tolerance, they won't pass the new check right, because their endpoints aren't close enough. is that what we want?

Can you help me understand the failure mode of the original code better?

@jamesbradleym
Copy link
Contributor Author

Well we only want to join things that are within tolerance of one another, that's the fuzzy distance we're defining as "The user is intending to join these but they just didn't perfectly snap the spaces together to get a straight wall".

If two lines overlap they do not require projection to be successfully merged with MergedCollinearLine. It doesn't matter that those end points are not within tolerance because they don't need projection and are already in the flow of being merged after passing:
if (line.TryGetOverlap(otherLine, out var overlap) || line.DistanceTo(otherLine) < tolerance)

The original code failed because judging the distance between two lines did not provide a distance that triggered the need for projection even though the line was off axis, aka was a distance between epsilon and tolerance.

@jamesbradleym
Copy link
Contributor Author

Per conversation:

At the point of reaching line merging we have grouped collinear lines, however line.IsCollinear(otherLine) let's nearly collinear lines join the group. This is all well and good, however line.MergedCollinearLine(otherLine) does not tolerate near collinearity and thus throws.

Therefore we must ensure these lines are actually collinear and actually within tolerance.

With that said, line.DistanceTo(otherLine) resolves to 0 for near 0 values while line.MergedCollinearLine(otherLine) does not tolerate this near zero distance. (Hence the previous commit to check for an actual near zero distance). Rather than check, let's project.

Copy link
Member

@wynged wynged left a comment

Choose a reason for hiding this comment

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

Reviewed all commit messages.
Reviewable status: 1 change requests, 0 of 1 approvals obtained, 1 unresolved discussion (waiting on @jamesbradleym)


LayoutFunctions/WallsLOD200/src/WallsLOD200.cs line 128 at r1 (raw file):

Previously, wynged (Eric Wassail) wrote…

I'm having trouble figuring what we've fundamentally changed and be sure we're not discarding something we might want to join.

like, what if there are two lines that overlap where the overlap is greater than tolerance, they won't pass the new check right, because their endpoints aren't close enough. is that what we want?

Can you help me understand the failure mode of the original code better?

done.


LayoutFunctions/WallsLOD200/src/WallsLOD200.cs line 127 at r2 (raw file):

                                // we project the lines because line.IsCollinear resolves to true on
                                // near 0 differences which MergedCollinearLine does not tolerate
                                // line.DistanceTo is similarly fuzzy and resolves to 0 on near (but greater than epsilon) distances

might not need this last line of the comment, unless you're going to add a note that this is why we're not using that method to determine if projection is necessary.

Copy link
Member

@wynged wynged left a comment

Choose a reason for hiding this comment

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

Reviewed 1 of 1 files at r2.
Reviewable status: 1 of 1 approvals obtained, 1 unresolved discussion (waiting on @jamesbradleym)

@jamesbradleym jamesbradleym merged commit 16a4136 into master Jun 19, 2024
1 check passed
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