18 float epsilon,
size_t uextent,
size_t vextent,
26 float vstartPrev, vendPrev, vstart = 0, vend = 0, vstartNext = 0, vendNext = 0;
27 size_t vsPrev, vePrev, vs = 0, ve = 0, vsNext = 0, veNext = 0;
28 float uangle = (bbox.
Min()[0] + .5f * epsilon) / m_sphere->
Radius();
29 float radius = std::sin(uangle) * m_sphere->
Radius();
33 (intptr_t)((vstartNext - bbox.
Min()[1]) / epsilon)));
35 (intptr_t)((vendNext - bbox.
Min()[1]) / epsilon)));
36 for (
size_t u = 0; u < uextent; ++u)
49 float uangleNext = ((u + 1.5f) * epsilon + bbox.
Min()[0]) / m_sphere->
Radius();
50 float radiusNext = std::sin(uangle) * m_sphere->
Radius();
54 (intptr_t)((vstartNext - bbox.
Min()[1]) / epsilon)));
56 (intptr_t)((vendNext - bbox.
Min()[1]) / epsilon)));
58 if (vstart <= bbox.
Min()[1] - epsilon
59 || vend >= bbox.
Max()[1] + epsilon
60 || !(*componentImg)[vs * uextent + u])
65 if ((*componentImg)[ve * uextent + u])
67 (*componentImg)[ve * uextent + u], &tempLabels);
69 && vstartPrev > bbox.
Min()[1] - epsilon
70 && vendPrev < bbox.
Min()[1] + epsilon
71 && (*componentImg)[vePrev * uextent + u - 1])
73 (*componentImg)[vePrev * uextent + u - 1], &tempLabels);
75 && vstartNext > bbox.
Min()[1] - epsilon
76 && vendNext < bbox.
Min()[1] + epsilon
77 && (*componentImg)[veNext * uextent + u + 1])
79 (*componentImg)[veNext * uextent + u + 1], &tempLabels);
83 for (
size_t i = tempLabels.
size() - 1; i > 0; --i)
89 labels->reserve(condensed.
size());
91 for (
size_t i = 0; i < tempLabels.
size(); ++i)
92 if (i == tempLabels[i].first)
94 labels->push_back(std::make_pair(count, tempLabels[i].second));
99 (*labels)[condensed[tempLabels[i].first]].second
100 += tempLabels[i].second;
102 for (
size_t i = 0; i < componentImg->
size(); ++i)
104 condensed[tempLabels[(*componentImg)[i]].first];
116 nframe.FromNormal(m_frame[2]);
118 nframe.ToTangent(m_frame[0], &t);
119 for (
unsigned int i = 0; i < 2; ++i)
123 float angle = std::atan2(t[1], t[0]);
127 o->write((
char*)&m_frame[2],
133 for (
unsigned int i = 0; i < 3; ++i)
135 (*o) << m_frame[2][i] <<
" ";
137 (*o) <<
angle <<
" ";
147 i->read((
char*)&normal,
sizeof(normal));
148 i->read((
char*)&rot,
sizeof(rot));
152 for (
unsigned int j = 0; j < 3; ++j)
158 m_frame.FromNormal(normal);
159 m_frame.RotateOnNormal(rot);