Skip to content

Conversation

@ffreyer
Copy link
Collaborator

@ffreyer ffreyer commented Mar 27, 2025

Fixes #251

Switched the generic orthogonal_vector to

$$\sum_i (q_i - q_1) \times (q_{i+1} - q_1) = \sum_i q_i \times q_{i+1} - q_0 \times q_{i+1} - q_i \times q_0$$

which is equivalent to the previous formula as the last two terms cancel. (Swapping the order of cross product inputs introduces a - which allows one term to cancel the other over the full summation.) (The summation skips the last iteration as q_i+1 - q_1 = q_1 - q_1 doesn't contribute.)

Also extended the types for the fast path so it's hit by default for triangle meshes again

All the failing triangles from #251 removed subtractions from the cross product. I added a few of these as tests, as well as one which doesn't remove subtractions. I also added another sanity check for faces with more than 4 vertices (verified on master) as I was getting confused about what length to expect.

@ffreyer ffreyer marked this pull request as ready for review March 27, 2025 19:06
@ffreyer ffreyer merged commit e55d51c into master Mar 28, 2025
14 checks passed
@ffreyer ffreyer deleted the ff/float-safety branch March 28, 2025 12:50
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.

#246 breaks face_normals(coordinates(mesh), faces(mesh))

2 participants