Skip to content
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

Vector data structure #3

Open
allo- opened this issue Jul 25, 2017 · 6 comments
Open

Vector data structure #3

allo- opened this issue Jul 25, 2017 · 6 comments

Comments

@allo-
Copy link
Contributor

allo- commented Jul 25, 2017

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

@nmoehrle
Copy link
Owner

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

@allo-
Copy link
Contributor Author

allo- commented Jul 25, 2017

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.

@nmoehrle
Copy link
Owner

Are you working on develop or master?

@allo-
Copy link
Contributor Author

allo- commented Jul 25, 2017

I am currently using a checkout from master.

@allo-
Copy link
Contributor Author

allo- commented Jul 29, 2017

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.

@nmoehrle
Copy link
Owner

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants