jonyballerino jonyballerino - 1 year ago 50
C++ Question

How to access each element of a Vector<3> from the TooN library?

I have a Vector<3> (of TooN.h library).
This should be a vector of a three elements (int), right?
How can I access to each int value?

I'd like to do something like:

#include <TooN/TooN.h>

// Create a vector initialised to [1 2 3];
Vector<3> v = makeVector(1, 2, 3);

//this is wrong!
int a = v.x; //a=1
int b = v.y; //b=2
int c = v.z; //c=3

Answer Source

According to the documentation you access the elements as v[0], v[1], v[2].

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download