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

Add SurfaceVertex #1048

Merged
merged 24 commits into from
Sep 6, 2022
Merged

Add SurfaceVertex #1048

merged 24 commits into from
Sep 6, 2022

Conversation

hannobraun
Copy link
Owner

Add a new form of vertices, SurfaceVertex, which is defined in 2D surface coordinates. Citing from one of the commit messages:

Some code needs to deal with vertices in surface coordinates.
Approximation is a current example of that, but there will be more in
the future.

Calculating these surface coordinates is a bit of an error-prone
process, for the same reason that calculating global coordinates is an
error-prone process: Surface coordinates that are supposed to be the
same can be slightly different, due to floating-point accuracy.

By having a SurfaceVertex, we're forcing code that creates vertices to
calculate those surface coordinates once, and then they are available to
all other code that deals with these vertices. This once-at-creation
calculation can then benefit from all the protections that are available
for the construction of objects (right now, this is the validation
infrastructure, but more can be done in the future).

The trade-off is complexity, but I think the added reliability (which isn't realized, since SurfaceVertex isn't included in validation yet) is worth it. Another way to view this change is that it doesn't add complexity, but just makes the inherent complexity explicit.

It would be a bit of a pay-off to update the curve approximation code to not re-compute the surface coordinates. But that would require some more changes there, and I felt that this pull request is already big enough.

Some code needs to deal with vertices in surface coordinates.
Approximation is a current example of that, but there will be more in
the future.

Calculating these surface coordinates is a bit of an error-prone
process, for the same reason that calculating global coordinates is an
error-prone process: Surface coordinates that are supposed to be the
same can be slightly different, due to floating-point accuracy.

By having a `SurfaceVertex`, we're forcing code that creates vertices to
calculate those surface coordinates once, and then they are available to
all other code that deals with these vertices. This once-at-creation
calculation can then benefit from all the protections that are available
for the construction of objects (right now, this is the validation
infrastructure, but more can be done in the future).
The purpose of this change is to make a following change smaller.
The purpose of this change is to make a following change smaller.
The purpose of this change is to make a following change smaller.
The purpose of this change is to make a following change smaller.
The purpose of this change is to make a following change smaller.
I'm not completely sure if this actually makes a difference, but I think
it can rule out some weird edge cases, where global vertices are
coincident because the surface connects to itself.
@hannobraun hannobraun enabled auto-merge September 6, 2022 11:26
@hannobraun hannobraun merged commit 054bc74 into main Sep 6, 2022
@hannobraun hannobraun deleted the vertex branch September 6, 2022 11:31
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