-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
gdal::VectorX Prototype #10744
gdal::VectorX Prototype #10744
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.
For testing, I assume you should be able to just include this .h file in a autotest/cpp/test_gdal_point_templ.cpp file added to gdal_unit_test
55472e5
to
ad7e167
Compare
What is "raw" about this point? Are there use cases other than the one here? |
TBH I do not remember. Maybe the point in the image coordinates, not in the CRS. But it should not be restricted to it. I am not happy with the name of the class, as I said in the PR description. I didn't call it directly
I hope so. Any algorithm that uses the coordinates of a point in the raster; or even in a geometry. This is a prototype to see if it makes sense (I didn't want to the class without any usecase). Once @rouault said it could be useful, I will improve it, with better documentation and tests. @dbaston this is the PR I mentioned in the meeting. |
The GDAL project highly values your contribution and would love to see this work merged! Unfortunately this PR has not had any activity in the last 28 days and is being automatically marked as "stale". If you think this pull request should be merged, please check
|
ad7e167
to
e7f2f9d
Compare
alg/gdal_interpolateatpoint.cpp
Outdated
@@ -17,6 +17,8 @@ | |||
|
|||
#include "gdalresamplingkernels.h" | |||
|
|||
#include "gdal_vectorx_templ.h" |
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 about shortening that to "gdal_vectorx.h" ? The template thing is just an implementation detail that a user using gdal::Vector2i wouldn't notice
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.
Done.
BTW, if there is a better location for this file than the folder alg
, I can move it.
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.
Would probably be better in gcore/
If you're wanting this, why not just use Eigen or similar? |
2ba37b6
to
58b5bc4
Compare
Adding a dependency like Eigen for such a small thing I think is not worth it. |
yes, the aim is not to do advanced linear algebra, but just to transport simple coordinate tuples. So perhaps that should be gdal::Tuple ? |
It is more than just a tuple. You can add an scalar to the vector, adding it to all the terms. Or multiply by a scalar. Or compute the norm. |
ok, gdal::VectorX is fine then. (ignore the Alpine failures. They are linked to package upgrades on their side) |
alg/gdal_vectorx.h
Outdated
#ifndef GDAL_VECTORX_H_INCLUDED | ||
#define GDAL_VECTORX_H_INCLUDED | ||
|
||
/*! @cond Doxygen_Suppress */ |
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 think this is a leftover of a copy-paste. Should this class be in Doxygen? I think so.
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.
As we don't install the file, this is debatable. There should be at least one warning in the class introduction that the file is for GDAL internal use for now
@jjimenezshaw anything left on your side before merging? |
I will add tomorrow the comment about the usage |
3d851ea
to
ba20ede
Compare
I think I am fine. |
What does this PR do?
During my work on the file
alg/gdal_interpolateatpoint.cpp
, I saw that there was a repetitive pattern: doing everything on X and Y. Both as integer to manage the pixel, and as double to use the coordinates in the image.I missed a functionality where x,y (or even x,y,z) could be used as an object, and do some basic operations on that, like subtract another point, multiply by a factor, etc. Something I am used to with Eigen library.
Once that development was finished I tried something, to see if it makes sense. This is it.
The main feature is the template class
VectorX
. Both the size and type are templated. You can make it double, int, even complex. Size can be any, but I think the most common would be 2, maybe 3. Four predefined types are included:Vector2i
,Vector3i
,Vector2d
,Vector3d
This PR is using it only in
alg/gdal_interpolateatpoint.cpp
.The idea is to use it internally. Not in any public API.
It should make the code more readable, and I hope it will help to not forget the Y or the X during developments.
What do you think? Is it useful? In case it is included, I don't expect a massive migration, but just start using it when it is convenient.
What are related issues/pull requests?
#10461, #10506, #10570
Tasklist