flambert
Registered Member

Hi,
I have two 3 dimensional discretized curves describt by 3 double arrays per curve (each curve has one array of doubles for x, one array for y, and one array for z). I have to make different calculations with this curves. For example, find the nearest point of curve 2 to an given point of curve 1, or calculate the normal vector on a specific point, and something else. I would like to use the eigenlibrary. Is ist a good idea? If so, what is the best way to store the arrays into Eigen::Vector3d (there are thousand of points)? Best regards, flambert 
ggael
Moderator

In order to get the best our of Eigen, I'd rather store the point coordinates into a Matrix<double,3,Dynamic,RowMajor>. This way data.row(0) gives you the vector of x, and data.col(i) gives you coordinates of the ith points. You can try ColMajor or RowMajor to see what works best in your case.
For instance, the bounding box is simply obtained as: data.rowwise().minCoeff(), data.rowwise().maxCoeff(). The tangent vectors of the n1 first points: data.tail(n1)  data(head(n1); ... 
Registered users: Baidu [Spider], Bing [Bot], Exabot [Bot], Google [Bot], kartaz, Majestic12 [Bot], meinanutshell, Sogou [Bot], YaCy [Bot], Yahoo [Bot]