Compute surface position on demand instead of storing it #1634
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.)
SurfaceVertex
is the representation of a vertex in surface coordinates. It stores the surface position of the vertex, and referencesGlobalVertex
(which stores the global position).SurfaceVertex
is referenced byHalfEdge
and theseSurfaceVertex
references are shared by the neighboringHalfEdge
s. Since neighboringHalfEdge
s can be defined by different curves (and floating point numbers are not infinitely accurate), computing the position of aSurfaceVertex
from theHalfEdge
can lead to slightly different results for the sameSurfaceVertex
.Such inconsistencies must be avoided, which is why surface positions are computed once and then stored in
SurfaceVertex
. However, there is a simpler way to void the inconsistency: By declaring that eachHalfEdge
"owns" its start vertex but not its end vertex (which is owned by the nextHalfEdge
in theCycle
), we can give eachHalfEdge
responsibility for computing the surface position of its start vertex. Then the stored position inSurfaceVertex
can be removed andSurfaceVertex
becomes redundant (only a reference toGlobalVertex
will be left, which can just be inlined whereverSurfaceVertex
is referenced).This issue has some overlap with #1525, which also would result in
SurfaceVertex
being removed. The issues are not in conflict, however, and in fact complement each other quite well. With #1525 addressed, this issue would become extremely trivial. Addressing this issue would in turn address most of the rest of #1525. Which order this will end up happening in is going to depend on practicalities, and I'll figure this out as I go.The text was updated successfully, but these errors were encountered: