diff options
author | Alex Auvolat <alex.auvolat@ens.fr> | 2015-02-01 23:44:41 +0100 |
---|---|---|
committer | Alex Auvolat <alex.auvolat@ens.fr> | 2015-02-01 23:44:41 +0100 |
commit | 97366c03e6a9fc9cc98455fd6dd84cdd0d8197f3 (patch) | |
tree | f77879e5d72574f88057f1b6b22ec0a2bca4e21b /ui.cpp | |
parent | 499d8b00d8017a32ae31deafc88416c452b48c8c (diff) | |
download | Robotique-Projet-97366c03e6a9fc9cc98455fd6dd84cdd0d8197f3.tar.gz Robotique-Projet-97366c03e6a9fc9cc98455fd6dd84cdd0d8197f3.zip |
Some of it works...
Diffstat (limited to 'ui.cpp')
-rw-r--r-- | ui.cpp | 20 |
1 files changed, 14 insertions, 6 deletions
@@ -213,6 +213,12 @@ void UI::render_pos(const hilare_a &pos, sf::Color c) { _win.draw(l); render_circle(circle(pos.pos_trolley(), pos.param->r_c_trolley), c, sf::Color::Transparent, 2); + + if (fabs(pos.phi) > 0.01) { + vec cc = pos.canon_curve_center(); + //render_circle(circle(cc, (pos.pos() - cc).norm()), c, sf::Color::Transparent, 2); + //render_circle(circle(cc, (pos.pos_trolley() - cc).norm()), c, sf::Color::Transparent, 2); + } } void UI::render_obstacle(const obstacle &o) { @@ -221,25 +227,27 @@ void UI::render_obstacle(const obstacle &o) { void UI::render_mvt(const hilare_a_mvt &m, sf::Color c) { if (m.is_arc) { - sf::Vertex l[20]; + const int nd = 42; + + sf::Vertex l[nd]; l[0] = sf::Vertex(to_view(m.from.pos()), c); double th = (m.from.pos() - m.center).angle(); double r = (m.from.pos() - m.center).norm(); - for (int i = 1; i < 19; i++) { - l[i] = sf::Vertex(to_view(m.center + vec::from_polar(r, th + m.domega * i / 20)), c); + for (int i = 1; i < nd - 1; i++) { + l[i] = sf::Vertex(to_view(m.center + vec::from_polar(r, th + m.domega * i / nd)), c); } - l[19] = sf::Vertex(to_view(m.to.pos()), c); + l[nd - 1] = sf::Vertex(to_view(m.to.pos()), c); - _win.draw(l, 20, sf::Lines); + _win.draw(l, nd, sf::LinesStrip); } else { sf::Vertex l[] = { sf::Vertex(to_view(m.from.pos()), c), sf::Vertex(to_view(m.to.pos()), c), }; - _win.draw(l, 2, sf::Lines); + _win.draw(l, 2, sf::LinesStrip); } } |