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

add getFaceCenter method #1091

Merged
merged 9 commits into from
Dec 24, 2015
Merged

add getFaceCenter method #1091

merged 9 commits into from
Dec 24, 2015

Conversation

kerautret
Copy link
Member

Tiny PR just to lighten some codes.

for ( auto &j: aFace){
c += getVertex(j);
}
return c/aFace.size();
Copy link
Member

Choose a reason for hiding this comment

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

implicit cast to int (or size_t) ?

Copy link
Member Author

Choose a reason for hiding this comment

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

yes ok I add a static_cast

@kerautret
Copy link
Member Author

done thanks

for ( auto &j: aFace){
c += getVertex(j);
}
return c/static_cast<typename TPoint::Component>(aFace.size());
Copy link
Member

Choose a reason for hiding this comment

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

well.. yes.. but If the mesh has integer coordinates vertices, the barycenter is a bit crappy since it may not lie on the surface.

Copy link
Member

Choose a reason for hiding this comment

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

maybe you should make this clear. Or decide that the output of "getbarycenter" is always a "RealPoint" and thus cast to double the denominator

Copy link
Member Author

Choose a reason for hiding this comment

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

ok for RealPoint it is more logic

@dcoeurjo
Copy link
Member

Ok fine.
Before merging, could you please fix conflicts with the master ?

@kerautret
Copy link
Member Author

yes done ;)

@dcoeurjo
Copy link
Member

thanks merging

dcoeurjo added a commit that referenced this pull request Dec 24, 2015
@dcoeurjo dcoeurjo merged commit 2ca27ba into DGtal-team:master Dec 24, 2015
@kerautret kerautret deleted the MeshAdd branch January 10, 2016 13:30
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.

2 participants