-
-
Notifications
You must be signed in to change notification settings - Fork 359
C++ sample code for The Barnsley Fern #835
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
Conversation
Thanks for the PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've reviewed a few things, this should disable warnings about "unsigned/signed" conversions.
Otherwise looks good to me.
It should be probably written somewhere that this is C++17 code?
using Row = std::array<double, 3>; | ||
using Op = std::array<Row, 3>; | ||
|
||
constexpr auto OpN = 4; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should probably be 4U, because of signedness.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is your motivation? I do not understand why it should be unsigned?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because I get warnings of signed/unsigned comparisons. Sorry I should've been clearer on this...
|
||
constexpr auto OpN = 4; | ||
|
||
template <int N> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should probably be template
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it is a template. What do you mean?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wooops, not sure what happened here.
I meant, this should probably be template <unsigned int N>
, again because of signed/unsigned comparison warngings
return x; | ||
} | ||
|
||
template <int N> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same, this should probably be template
return v; | ||
} | ||
|
||
template <int N> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same, this should probably be template
|
||
auto operator*(const Op& x, const Vec3& y) { | ||
auto ret = Vec3{}; | ||
for (auto i = 0; i < 3; ++i) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should probably be auto i = 0U
auto ret = Vec3{}; | ||
for (auto i = 0; i < 3; ++i) { | ||
ret[i] = 0; | ||
for (auto j = 0; j < 3; ++j) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should probably be auto j = 0U
Mitia, I pushed fixes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks again for the code and thanks to @ShadowMitia for the review!
The Barnsley Fern with 100000 points
