ImFusion SDK 4.3
ImFusion::Utils::EigenVectorWrapperImpl Namespace Reference

Wrapper classes for using std::vector<Eigen::Matrix<T,N,1>> with arbitrary T and N as input of a non-template function. More...

Detailed Description

Wrapper classes for using std::vector<Eigen::Matrix<T,N,1>> with arbitrary T and N as input of a non-template function.

TL/DR: Just pass a std::vector<vec2/3/4(f)> when you encounter these as a function argument.

Wrapper implicitly converts std::vectors of arbitrary Eigen vectors to std::vector<Eigen::Matrix<InsideType, InsideDimension, 1>>. Is based on std::vector<Eigen::Matrix<InsideType, InsideDimension, 1>> and mostly can be used as such. When Output is set to true, the final state of the wrapper content will be copied back into the input data. When Optional is set to true, the object may be invalid (empty initializer or nullptr), for use as optional arguments of a function. If the input Eigen objects have a different number of rows than InsideDimension, the missing elements are set to FillValue. This class is intended to be used for implicit conversions during function calls and should be used with care in any other context.

DANGER: Do NOT under any circumstances use a pointer to the std::vector base class to own this thing (no virtual destructor).

Example usage:

void someFunc(
{
if(optionalInput && optionalInput.size())
output = std::vector<vec3>(4, optionalInput[0]);
else
output = input;
}
bool itsWednesday;
someFunc(a, b, c); //Enabled optional argument
someFunc(c, a); //Defaulted optional argument
someFunc(b, c, nullptr); //Disabled optional argument
someFunc(b, c, {}); //Disabled optional argument, alternative style
someFunc(a, b, {c, itsWednesday}); //Conditional optional argument
Simple case: non-optional input argument.
Definition EigenVectorWrapper.h:125
Optional input argument.
Definition EigenVectorWrapper.h:167
Non-optional output argument.
Definition EigenVectorWrapper.h:144

Classes

struct  EigenVectorWrapperBase
 
struct  EigenVectorWrapperOptionalBase
 
struct  EigenVectorWrapperOutputBase
 
Search Tab / S to search, Esc to close