Skip to main content Link Menu Expand (external link) Document Search Copy Copied

PVector(std::initializer_list<double> l)

This creates a new vector from an initializer list (a list of values in curly braces). This throws an error if the list has more than 3 elements.

Parameters

  • l - The initializer list to use

Examples

//A 3 element initializer list
PVector v = PVector({1.0, 2.0, 3.0});
/*
v.x == 1.0
v.y == 2.0
v.z == 3.0
*/
//A 2 element initializer list
PVector v = PVector({1.0, 2.0});
/*
v.x == 1.0
v.y == 2.0
v.z == 0.0
*/

See Also