-
Notifications
You must be signed in to change notification settings - Fork 41
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 ellipsoid geometry #1221
Add ellipsoid geometry #1221
Conversation
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.
Posting in progress review
KOKKOS_FUNCTION | ||
constexpr Ellipsoid( | ||
Point<DIM, Coordinate> const ¢roid, | ||
std::initializer_list<std::initializer_list<Coordinate>> const rmt) |
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.
Why do we want this constructor?
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.
For unit tests to allow {{a, b}, {b, c}}
initialization.
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.
You could(should?) have used array of arrays
constexpr auto const ¢roid() const { return _centroid; } | ||
|
||
KOKKOS_FUNCTION | ||
constexpr auto const &rmt() const { return _rmt; } |
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's RMT?
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.
Riemann metric tensor
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.
Add a comment...
#else | ||
KOKKOS_FUNCTION | ||
#endif | ||
Ellipsoid(T const (&)[N], T const (&)[N][N]) -> Ellipsoid<N, T>; |
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.
Why do we have this deduction guide and a constructor from an initializer lists instead of having a constructor from array of arrays?
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 was trying to make things work well enough. If you have a better approach that would simplify things, it would be nice. I want to be able to construct ellipsoid as
Ellipsoid ellipse{{3, 1}, {1, 3}}; // testing
float rmt[2][2];
// initialize rmt
Ellipsoid ellipse1{Point{0,0}, rmt};
@@ -512,6 +515,123 @@ struct intersects<BoxTag, SegmentTag, Box, Segment> | |||
} | |||
}; | |||
|
|||
namespace |
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.
Why anonymous space here?
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 try to use anonymous spaces when I know it's not needed anywhere outside of this file.
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 is a header file though
{ | ||
// Computes x^t R y | ||
template <int DIM, typename Coordinate> | ||
KOKKOS_INLINE_FUNCTION auto rmt_multiply(Details::Vector<DIM, Coordinate> x, |
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.
Any good reason not to spell out that it returns Coordinate
instead of auto
?
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.
No good reason. I find either acceptable.
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.
In that case it is slightly less readable
template <typename Point, typename Ellipsoid> | ||
struct intersects<PointTag, EllipsoidTag, Point, Ellipsoid> | ||
{ | ||
KOKKOS_FUNCTION static constexpr bool apply(Point const &point, | ||
Ellipsoid const &ellipsoid) | ||
{ | ||
return Details::intersects(ellipsoid, point); | ||
} | ||
}; |
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.
Don't we generate intersects(geom2, geom1)
from instersects(geom1, geom2)
?
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.
We don't. If you know of an easy way to do it, I'm all ears. Boost geometry does it, but I can't quite recall why we couldn't do it that way.
Exprimental::Ellipsoid