Hello to all,
In my program I have a set of N vectors (I mean cartesian 3D vectors, represented by C++ vector containers of properly defined structs that I called vectorType). These 3D vectors are ordered according to their length, shortest first.
I start with the shortest, and then go over all of them keeping only those which have an angular separation with each of the already kept ones that is bigger than a certain value. This comparison part is what I do not know how to do.
In pseudocode (V are the 3D vectors, V.at(0) being the shortest:
The part I don't know how to write is the multiple if statements (or whatever is better) for a growing number of elements to compare with.Code:std::vector< vectorType > W; W.push_back( V.at(0) ); for ( k=1; k<N; k++) { if ( angle(&V.at(k), &W.at(0)) > theta ) and if ( angle(&V.at(k), &W.at(1)) > theta ) and ... if ( angle(&V.at(k), &W.at(L)) > theta ) // L is current W.size() then W.push_back( V.at(k) ) }
If anyone could give me a hint of how to do that, it would be most appreciated.
Thanks,
mc61



LinkBack URL
About LinkBacks



CornedBee