libacc icon indicating copy to clipboard operation
libacc copied to clipboard

Vector data structure

Open allo- opened this issue 7 years ago • 6 comments

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 to squaredNorm
  • change Vec3fType(inf) to Vec3fType(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).

allo- avatar Jul 25 '17 13:07 allo-

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

nmoehrle avatar Jul 25 '17 15:07 nmoehrle

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.

allo- avatar Jul 25 '17 15:07 allo-

Are you working on develop or master?

nmoehrle avatar Jul 25 '17 15:07 nmoehrle

I am currently using a checkout from master.

allo- avatar Jul 25 '17 15:07 allo-

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.

allo- avatar Jul 29 '17 16:07 allo-

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...

nmoehrle avatar Jul 31 '17 21:07 nmoehrle