Consolidate redundant references to Surface
#1588
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
(This issue is part of a larger cleanup effort. See #1589.)
As of this writing,
Surface
is referenced by bothCurve
andSurfaceVertex
. Those references must be consistent: aHalfEdge
is only valid, if theCurve
and theSurfaceVertex
instances it references all reference the sameSurface
. In turn, allHalfEdge
s in aCycle
must (transitively) reference the sameSurface
, and allCycle
s in aFace
must do so.This redundancy makes building and modifying these objects unnecessarily hard. There also need to be validation checks on every level from
HalfEdge
upwards to verify consistency. I believe it would be better to referenceSurface
only once, inFace
. This would simplify the object graph a lot.It would also mean that
Surface
is farther away from where it is often needed (for example, to approximate a curve in 3D space, you need the surface that it is defined on). But I think this can be addressed by structuring the code that usesSurface
differently, on a case-by-case basis. I think that overall, this will be a worthwhile trade-off, as any additional complexity in code usingSurface
would be largely restricted to that code, while the additional complexity in the object graph affects the whole kernel negatively.This issue is closely related to other cleanup efforts, namely #1525, #1570, and #1586. It will probably not be possible to address each of those in isolation, as the very complexity these issues aim to address tends to hinder them. Most likely, the issues will be addressed together, by picking low-hanging fruit from each of them, until all of them have been addressed. This is something I am actively working on right now.
The text was updated successfully, but these errors were encountered: