Simplify use of local forms #691
Labels
topic: core
Issues relating to core geometry, operations, algorithms
type: development
Work to ease development or maintenance, without direct effect on features or bugs
Milestone
Once upon a time, the Fornjot kernel only dealt in 3D coordinates, converting them into other forms (like local curve or surface coordinates) only where necessary. This changed for various reasons, and now all object types that reference other objects, keep a local form of the referenced object, where appropriate.
While I still believe that this was a necessary change, it certainly has made a lot of the code much more complicated than it needs to be. And this wasn't unexpected, as I was still exploring the design space. This first over-complicated design taught me a lot, and after using and reflecting on it for a while, I think I've come up with something simpler.
First, a rough overview over the current design, to put the following improvements into context:
Handle<Vertex>
) have been replaced with that same reference, side-by-side with the local form of the same object (e.g.LocalForm<Point<1>, Vertex>
).Edge
, which now exists asEdge<2>
andEdge<3>
.Shape
. The local form is always stored together with the reference to the canonical form, in the referring object. TheLocalForm
struct is used to make this a bit easier.I believe that this design can be simplified in the following ways:
Shape
, where they reference their own canonical form (and possibly their local context, i.e. the curve or surface) using a regularHandle
.LocalForm
again, at least in its current form. Replace every use of it with a regularHandle
to the local form. This is not any less general, as the local form references its own canonical form, meaning you can always retrieve the canonical form with one extra step.Edge
andCycle
non-generic again. Instead of having anEdge<2>
that references local forms, and anEdge<3>
that references canonical forms, just have a simple/non-genericEdge
, that references the local form.I believe that these steps have the potential to make things much simpler again. I am going to start working on this immediately, as realizing those simplifications will make everything else I'm working on much easier.
The text was updated successfully, but these errors were encountered: