X-Git-Url: https://fleuret.org/cgi-bin/gitweb/gitweb.cgi?p=folded-ctf.git;a=blobdiff_plain;f=pi_referential.cc;h=c2b716e34862183eccd9eb00f14d49700ee23fb1;hp=6f5609917da0d0a0820fbee6d430551656b56cc6;hb=33852c7b378d419be75d15a9663ee6b071c2f534;hpb=789f96ef05fda4588aa536adb614c0e841be0812 diff --git a/pi_referential.cc b/pi_referential.cc index 6f56099..c2b716e 100644 --- a/pi_referential.cc +++ b/pi_referential.cc @@ -70,20 +70,10 @@ void PiReferential::draw_frame(RGBImage *image, image->draw_line(2, r, g, b, x3, y3, x4, y4); image->draw_line(2, r, g, b, x4, y4, x1, y1); } else { - // int xc = (x1 + x2 + x3 + x4)/4, yc = (y1 + y2 + y3 + y4)/4; - // image->draw_line(1, r, g, b, xc - delta, yc, xc + delta, yc); - // image->draw_line(1, r, g, b, xc, yc - delta, xc, yc + delta); image->draw_line(2, r, g, b, x1, y1, x2, y2); image->draw_line(2, r, g, b, x2, y2, x3, y3); image->draw_line(2, r, g, b, x3, y3, x4, y4); image->draw_line(2, r, g, b, x4, y4, x1, y1); - // image->draw_line(2, r, g, b, - // (2*xc + 5 * x1 + 5 * x2)/12, (2 * yc + 5 * y1 + 5 * y2)/12, - // (x1 + x2)/2, (y1 + y2)/2); - // image->draw_line(6, r, g, b, - // (2*xc + 3 * x2 + 3 * x3)/8, (2 * yc + 3 * y2 + 3 * y3)/8, - // (x2 + x3)/2, (y2 + y3)/2 - // ); } } @@ -308,6 +298,7 @@ PiReferential::PiReferential(PoseCell *cell) { // Frames if(_body_xc >= _head_xc) { +// if(_belly_xc >= _head_xc) { _horizontal_polarity = 1; } else { _horizontal_polarity = -1; @@ -358,8 +349,8 @@ PiReferential::PiReferential(PoseCell *cell) { scalar_t l = sqrt(_head_belly_vx * _head_belly_vx + _head_belly_vy * _head_belly_vy); - _head_belly_vx = _head_belly_vx/l * _head_radius * 2; - _head_belly_vy = _head_belly_vy/l * _head_radius * 2; + _head_belly_vx = (_head_belly_vx / l) * _head_radius * 2; + _head_belly_vy = (_head_belly_vy / l) * _head_radius * 2; _head_belly_edge_shift = int(floor(- RichImage::nb_edge_tags * atan2(_head_belly_ux, _head_belly_uy) / (2 * M_PI) + 0.5)); _head_belly_edge_shift = (RichImage::nb_edge_tags + _head_belly_edge_shift) % RichImage::nb_edge_tags; }