37 return {pt.x*x,pt.y*y};
39 inline vector_2d operator *(
const float val) {
43 return {x/pt.x,y/pt.y};
45 inline vector_2d operator /(
const float val) {
49 return {pt.x+x,pt.y+y};
51 inline vector_2d operator +(
const float val)
const{
55 return {x-pt.x,y-pt.y};
57 inline vector_2d operator -(
const float val)
const{
64 float length = 1/
len() ;
92 inline std::vector<vector_2d> normals(std::vector<vector_2d> segments)
96 std::vector<vector_2d> out;
97 for(
unsigned i=0; i<segments.size()-1; i++)
99 normal = segments.at(i+1)-segments.at(i);
103 tmpNormal =tmpNormal + normal;
105 out.push_back( tmpNormal);
110 out.push_back( tmpNormal);
116 std::vector<vector_2d> out;
118 float len = tmpvec.
len();
119 if (!len)
return out;
126 int nbsub = ceilf(len / maxlen);
130 for (;nbsub>0;nbsub--)
143 return {val*vect.x,val*vect.y};
149 return {val-vect.x,val-vect.y};
152 return {vect.x-val , vect.y-val};
155 static inline float minf(
float a,
float b) {
return a < b ? a : b; }
156 static inline float maxf(
float a,
float b) {
return a > b ? a : b; }
float len()
parse the xml file to load params
Definition: OE_utils.h:87
void normalize()
normalise the vector (his length become 1)
Definition: OE_utils.h:63
void turnRight()
turn the vector 90° to the right
Definition: OE_utils.h:72
Definition: OE_utils.h:28