Is there a standard 3d vector class in C ++

In an existing project, I see a Vector_3d template, templated, with the usual operations for vectors (in the sense of algebra). After profiling, I noticed that most of the time is spent in this class.

I was wondering if there was a well-known implementation of such a basic concept as a 3d vector in C ++. Indeed, it would be easier to use a good implementation of the vector instead of trying to optimize this one.

Edit: This is in the context of the geometric representation of some objects. But it does not depend on any visualization. I will see if there is a way to avoid using too many methods frequently. And I will look at the packages offered.

+5
source share
3 answers

There are not many opportunities to improve the class of 3d vectors (basically, dot / cross products are pretty simple, matrix multiplication). If so much time is spent on this class, perhaps your code using it is wrong. You checked against

  • copy and links
  • incorrect association (for example, multiply the matrix, and then all vectors in the resulting matrix, and not all vectors in the matrix chain)

I know that Qt has QVector3D that can help you (by the way, they got Vector 2D and 4D for common 3D geometry operations)

+6
source

Dave Eberly http://www.geometrictools.com/ is an excellent resource for these types of classes.

+3
source

Eigen. , .

+1

All Articles