4.2 Edge2

An Edge2 is a line. Just as with Vec2, the ’2’ is important. The code will still be valid when you use an Edge instead of an Edge2, but that class is intended for drawing in 3D instead. To define an Edge2, you need two points (Vec2), being the beginning and the end. Esenthel offers two methods to pass these to the object:

 
Edge2 e1; 
Edge2 e2; 
 
// using newly created vectors ... 
5e1.set(Vec2(0, 0), Vec2(0.1, 0.1)); 
 
// ... or existing vectors 
Vec2 pos1(0.3, 0.6); 
Vec2 pos2(0.1, 0.2); 
10e1.set(pos1, pos2); 
 
// set all x and y values as floats 
e2.set(-0.4, 0.2, -0.7, 0.9;