plexus
plexus copied to clipboard
Perform basic unit-level topology validation when committing mutations.
Today, mutations do not perform very much validation. FaceMutation is probably the most sophisticated, and ensures that consistent meshes are manifolds, but the most basic invariants for vertices, edges, and faces are not rigorously examined.
This could be accomplished by introducing some kind of JournaledStorage type that wraps (and owns) storage and tracks all accessed topologies. During a commit, any touched topologies can be examined for basic consistency. For example, any touched edges must have an opposite edge. Using a wrapper ensures that no accesses are missed.
Introducing a new type like JournaledStorage could once again increase the type complexity in Plexus' internals. Currently, storage is accessed via the AsStorage trait, which exposes a reference to a Storage structure. There is no trait for that interface, nor does AsStorage support parameterizing this beyond the topological type of the Storage it exposes (i.e., vertex, edge, or face).
Putting storage behind a trait would complicate this pattern quite a bit and touch a lot of code. On the other hand, perhaps a trait should have been used for storage from the beginning.