5 #ifndef BALL_DATATYPE_CONTOURLINE_H
6 #define BALL_DATATYPE_CONTOURLINE_H
12 #ifndef BALL_DATATYPE_REGULARDATA2D_H
22 #define INTERPOL12 { \
23 vec = from.getCoordinates(from.getClosestIndex(Vector2(act_cell_x, act_cell_y)));\
24 d1 = from[act_cell_x + act_cell_y*(number_of_cells_x+1)];\
25 d2 = from[act_cell_x + 1 + act_cell_y*(number_of_cells_x+1)];\
26 vec2 = from.getCoordinates(from.getClosestIndex(Vector2(act_cell_x + 1, act_cell_y + 1)));\
27 slope = (d2 - d1) / (vec2.x - vec.x);\
28 vec.x += (threshold - d1)/slope;\
29 data_.push_back(vec);\
32 #define INTERPOL18 { \
33 vec = from.getCoordinates(from.getClosestIndex(Vector2(act_cell_x, act_cell_y)));\
34 d1 = from[act_cell_x + act_cell_y*(number_of_cells_x+1)];\
35 d2 = from[act_cell_x + (act_cell_y+1)*(number_of_cells_x+1)];\
36 vec2 = from.getCoordinates(from.getClosestIndex(Vector2(act_cell_x, act_cell_y+1)));\
37 slope = (d2 - d1) / (vec2.y - vec.y);\
38 vec.y += (threshold - d1)/slope;\
39 data_.push_back(vec);\
42 #define INTERPOL24 { \
43 vec = from.getCoordinates(from.getClosestIndex(Vector2(act_cell_x+1, act_cell_y)));\
44 d1 = from[act_cell_x+1 + act_cell_y*(number_of_cells_x+1)];\
45 d2 = from[act_cell_x+1 + (act_cell_y+1)*(number_of_cells_x+1)];\
46 vec2 = from.getCoordinates(from.getClosestIndex(Vector2(act_cell_x+1, act_cell_y+1)));\
47 slope = (d2 - d1) / (vec2.y - vec.y);\
48 vec.y += (threshold - d1)/slope;\
49 data_.push_back(vec);\
53 #define INTERPOL48 { \
54 vec = from.getCoordinates(from.getClosestIndex(Vector2(act_cell_x+1, act_cell_y+1)));\
55 d1 = from[act_cell_x+1 + (act_cell_y+2)*(number_of_cells_x+1)];\
56 d2 = from[act_cell_x + (act_cell_y+1)*(number_of_cells_x+1)];\
57 vec2 = from.getCoordinates(from.getClosestIndex(Vector2(act_cell_x, act_cell_y+1)));\
58 slope = (d2 - d1) / (vec2.x - vec.x);\
59 vec.x += (threshold - d1)/slope;\
60 data_.push_back(vec);\
118 virtual void clear();
147 typename VectorType::iterator
it_;
155 template <
typename T>
162 template <
typename T>
167 template <
typename T>
169 : height_(from.height_),
176 template <
typename T>
184 template <
typename T>
195 template <
typename T>
198 return ((height_ == data.
height_)
199 && (data_ == data.
data_)
201 && (index_ == data.
index_));
204 template <
typename T>
209 Size number_of_cells_x;
210 Size number_of_cells_y;
214 double d1, d2, slope;
215 double threshold = height_;
220 for (act_cell_y = 0; act_cell_y < number_of_cells_y; act_cell_y++)
222 for (act_cell_x = 0; act_cell_x < number_of_cells_x; act_cell_x++)
227 if (from[act_cell_x + act_cell_y * (number_of_cells_x+1)] > threshold)
231 if (from[act_cell_x + 1 + act_cell_y * (number_of_cells_x+1)] > threshold)
235 if (from[act_cell_x + 1 + (act_cell_y + 1)*(number_of_cells_x + 1)] > threshold)
239 if (from[act_cell_x + (act_cell_y + 1) * (number_of_cells_x + 1)] > threshold)
304 template <
typename T>
307 if (index_ < data_.size())
320 template <
typename T>