Essay record
C++: Eigen::Vector2d - How to Access X and Y Values
- Record
- Essay / / 1 min read / 69 words
- Tags
- Unfiled
DISCLOSURE: Some links may be affiliate links. Details
**Problem: **I have a std::vectorEigen::Vector2d variable storing a bunch of points. How do I access the X and Y values of each of these points?
**Solution: **Vector2d takes in a binary value and returns the X or Y value respectively.
double x = aVector(0);
double y = aVector(1);
Similarly, in order to change these values you can:
aVector(0) += 50;
aVector(1) -= 100;