Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Safety with updating cached geometric quantitie #36

Open
CunchengZhu opened this issue Mar 9, 2021 · 1 comment
Open

Safety with updating cached geometric quantitie #36

CunchengZhu opened this issue Mar 9, 2021 · 1 comment

Comments

@CunchengZhu
Copy link
Collaborator

When doing topology changes, one needs to consistently maintain the validity of cached geometric quantities such as the corner angles. However, refresh quantities as a whole is expensive. Note that some values in GC are referred to as immediate values which "do not need to be cached".

@CunchengZhu
Copy link
Collaborator Author

Mem3DG/src/init.cpp

Lines 336 to 355 in 8bc7b53

for (gcs::Corner c : mesh->corners()) {
// WARNING: Logic duplicated between cached and immediate version
gcs::Halfedge he = c.halfedge();
gc::Vector3 pA = vpg->vertexPositions[he.vertex()];
he = he.next();
gc::Vector3 pB = vpg->vertexPositions[he.vertex()];
he = he.next();
gc::Vector3 pC = vpg->vertexPositions[he.vertex()];
GC_SAFETY_ASSERT(he.next() == c.halfedge(), "faces must be triangular");
double q = dot(unit(pB - pA), unit(pC - pA));
q = clamp(q, -1.0, 1.0);
double angle = std::acos(q);
vpg->cornerAngles[c] = angle;
}
vpg->refreshQuantities();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant