Essay - Published: 2016.01.30 |
DISCLOSURE: If you buy through affiliate links, I may earn a small commission. (disclosures)
**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;
The best way to support my work is to like / comment / share for the algorithm and subscribe for future updates.