libacc
libacc copied to clipboard
Vector data structure
While you're using a template argument for the vector format, you have quite concrete requirements on the vector (i.e. it needs to implement dot and cross product), without having an example implementation in the repository. This makes it hard to actually use it in such a generic way (you would for example expect to be able to use std::vector, std::valarray, double[3] for a real generic structure).
But your expected structure works quite fine with libeigen Eigen::Vector3f, if you change a few things:
- change
squared_norm
tosquaredNorm
- change
Vec3fType(inf)
toVec3fType(inf, inf, inf)
everywhere.
Another thing is, that you might consider to make float
a template, so data structures using doubles can be used as well (i.e. Eigen::Vector3d
).
First of all thanks for the interest in the lib :-)
Regarding your points
- making float is certainly a good idea
- sorry about the examples, the project originated in rayint where I did include a reference implementation for the Vec3fType (from MVE's math lib)
- this lib was primarily used together with MVE which is also the reason for the name
square_norm
, this will make it difficult to just change it. But having that said I would love to support the Eigen vectors and I will look for a solution there. I guess I'll just have to write it myself...
Best, Nils
Thank you for the library, it works quite good so far. I am using it for distance fields here.
Hmm, i guess it's hard to generalize on the vector library, while it still worked quite good with libeigen.
I guess for something that complex you would either need to fix a library or require just the minimum and implement the rest yourself. But when it (almost) works with both libraries, the support for the two can be just a #define
.
I will send you PRs when I change major things. Currently I did a rather unclean replace-all on float to double myself and did not test the kdtree at all.
Are you working on develop or master?
I am currently using a checkout from master.
Is develop working as well as master? I think I will need it anyway for the ray-triangle test. Then i could merge this with develop and cherry pick the index-range patch from master.
Yes develop is quite a little in front of master, it's just that I wasn't sure if I want to change the interface...