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

Used std::vector instead of c-style arrays for point storage. #8709

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

SharonIV0x86
Copy link
Contributor

Updated two CGAL examples to use std::vector instead of plain C-style arrays for storing points.

Few more examples can be improved the same way to use std::vector and avoid usage of c-style arrays.

  • Min_annulus_d
  • Min_circle_2
  • Min_ellipse
  • Min_sphere_d

@lrineau
Copy link
Member

lrineau commented Jan 22, 2025

In case the size is known at compile time, please use std::array<Point, n> instead of std::vector<Point>.

@SharonIV0x86
Copy link
Contributor Author

In case the size is known at compile time, please use std::array<Point, n> instead of std::vector<Point>.

Nice suggestion, initially i thought of using std::array but dropped the idea, will work on it.

// (0,0), (-1,0), (2,0), (-3,0), ...
}

Min_circle mc1( P, P+n, false); // very slow
Min_circle mc2( P, P+n, true); // fast
Min_circle mc1( P.begin(), P.begin() + n, false); // very slow
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Min_circle mc1( P.begin(), P.begin() + n, false); // very slow
Min_circle mc1( P.begin(), P.end(), false); // very slow

Min_circle mc1( P, P+n, false); // very slow
Min_circle mc2( P, P+n, true); // fast
Min_circle mc1( P.begin(), P.begin() + n, false); // very slow
Min_circle mc2( P.begin(), P.begin() +n, true); // fast
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Min_circle mc2( P.begin(), P.begin() +n, true); // fast
Min_circle mc2( P.begin(), P.end(), true); // fast

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

Successfully merging this pull request may close these issues.

3 participants