Debian Codegraph @

cvd_src/draw_toon.cc

raw symbols SCIP
1
2 #include <TooN/helpers.h>
3 #include <cvd/draw.h>
4 #include <utility>
5 using namespace TooN;
6 using namespace std;
7
8 namespace CVD
9 {
10
11 static double len2(const Vector<2>& v)
12 {
13 return v * v;
14 }
15
16 vector<ImageRef> getSolidEllipse(float r1, float r2, float theta)
17 {
18 vector<ImageRef> e;
19
20 int r = (int)ceil(max(r1, r2) + 1);
21 Matrix<2> t;
22 t[0] = makeVector(cos(theta), sin(theta)) / r1;
23 t[1] = makeVector(-sin(theta), cos(theta)) / r2;
24
25 for(int y = -r; y <= r; y++)
26 for(int x = -r; x <= r; x++)
27 if(len2(t * makeVector(x, y)) <= 1)
28 e.push_back(ImageRef(x, y));
29 return e;
30 }
31
32 };