1 #ifndef OPENANN_LAYERS_SIGMA_PI_CONSTRAINTS_H_
2 #define OPENANN_LAYERS_SIGMA_PI_CONSTRAINTS_H_
18 : width(width), height(height)
25 double x1 = p1 % width;
26 double y1 = p1 / width;
27 double x2 = p2 % width;
28 double y2 = p2 / width;
33 return (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2);
48 : width(width), height(height)
56 double x1 = p1 % width;
57 double y1 = p1 / width;
58 double x2 = p2 % width;
59 double y2 = p2 / width;
64 return (x1 == x2) ? (M_PI / 2) : std::atan((y2 - y1) / (x2 - x1));
88 else if(fabs(
beta - tuple.
beta) > 0.001)
106 : width(width), height(height), resolution(resolution)
113 int nr = partition.size() / 3.0;
132 int as = (x2 - x3) * (x2 - x3) + (y2 - y3) * (y2 - y3);
133 int bs = (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2);
134 int cs = (x1 - x3) * (x1 - x3) + (y1 - y3) * (y1 - y3);
137 double alpha = std::floor(std::acos((as - bs - cs) / (-2 * std::sqrt(bs * cs))) / resolution);
138 double beta = std::floor(std::acos((bs - cs - as) / (-2 * std::sqrt(cs * as))) / resolution);
139 double gamma = std::floor(std::acos((cs - as - bs) / (-2 * std::sqrt(as * bs))) / resolution);
145 std::map<AngleTuple, int>::const_iterator it = partition.find(t1);
147 std::map<AngleTuple, int>& p =
const_cast<std::map<AngleTuple, int>&
>(partition);
149 if(it == partition.end())
164 std::map<AngleTuple, int> partition;
173 #endif // OPENANN_LAYERS_SIGMA_PI_CONSTRAINTS_H_