Skip to content

WIP : fix PMP::compute_vertex_normal#2065

Closed
janetournois wants to merge 2 commits intoCGAL:masterfrom
janetournois:PMP-fix_compute_vertex_normal-jtournois
Closed

WIP : fix PMP::compute_vertex_normal#2065
janetournois wants to merge 2 commits intoCGAL:masterfrom
janetournois:PMP-fix_compute_vertex_normal-jtournois

Conversation

@janetournois
Copy link
Copy Markdown
Member

This PR should be discussed in the issue before going further.

Summary of Changes

This PR intends to improve the PMP::compute_vertex_normal(v) function, by changing the weights of face normals that are summed to compute a normal at vertex v.

The former implementation used 1 as weight, and the new weight is sin(angle at v in f).
It is cheaper than computing (angle at v in f), and should behave similarly.

Release Management

the new weight is sin(angle at v)
it is cheaper than computing (angle at v), and should behave similarly
@janetournois janetournois changed the title WIP : fix PMP::compute_vertex_normal WIP : fix PMP::compute_vertex_normal Apr 19, 2017
get(vpmap, target(next(he, pmesh), pmesh)));
//v(i) and v(i+1) must me seen in ccw order, from v, so we reverse v1 and v2
Vector ni = traits.construct_cross_product_vector_3_object()(v2, v1);
ni = traits.construct_scaled_vector_3_object()(ni, CGAL::sqrt(1./(sqlen(v1)*sqlen(v2))));
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The expression CGAL::sqrt(1./(sqlen(v1)*sqlen(v2))) does not compile with Gmpq as the FT. That error was detected by Travis: https://travis-ci.org/CGAL/cgal/jobs/223571577#L4670

Did you get a mail from Travis, by the way?

Copy link
Copy Markdown
Member Author

@janetournois janetournois Apr 20, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

right. I should use CGAL::approximate_sqrt.
Just a remark : the documentation says that, even with an exact kernel, the sqrt inside will involve non exact computations.

And No, I did not get an email from Travis.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should also write FT(1)/x instead of 1./x, so that it compiles with number types that cannot be constructed from a double.

@lrineau
Copy link
Copy Markdown
Member

lrineau commented May 15, 2017

This PR conflicts with master... anyway, if I remember well, it waits for a larger discussion among us.

@lrineau lrineau modified the milestone: 4.12-beta Jul 17, 2017
@lrineau lrineau modified the milestones: 4.12-beta, 4.13-beta Jan 24, 2018
@lrineau lrineau removed this from the 4.13-beta milestone Jun 26, 2018
@lrineau lrineau added this to the Trash / Attic milestone Jan 7, 2019
@lrineau
Copy link
Copy Markdown
Member

lrineau commented Jun 20, 2019

@janetournois, do you know why this pull-request was left unattended? It seems there was a discussion, and then... I do not know.

@janetournois
Copy link
Copy Markdown
Member Author

janetournois commented Jun 20, 2019

Yes I remember.
We started a discussion in issue #2047, but it was not conclusive so this PR stayed as is.

Imho it's not obsolete and the implemented solution should be improved at some point.

@sloriot
Copy link
Copy Markdown
Member

sloriot commented Jun 20, 2019

Note that @MaelRL has a very good method implemented for another project and he will at some point export it properly.

@janetournois
Copy link
Copy Markdown
Member Author

Sounds good!

@lrineau lrineau closed this Jun 21, 2019
@janetournois janetournois deleted the PMP-fix_compute_vertex_normal-jtournois branch September 28, 2023 10:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug in PMP::compute_vertex_normal()

4 participants