rs->x2 = e->n2->o->x;
rs->y2 = e->n2->o->y;
- rs->slope = (rs->y2 - rs->y1) / (rs->x2 - rs->x1);
- ((struct sym_text *) rs->label)->rotate = convert_to_deg(atan(rs->slope));
+ if (fabs(rs->x2 - rs->x1) > 0.01)
+ {
+ rs->slope = (rs->y2 - rs->y1) / (rs->x2 - rs->x1);
+ // This works a little bit magically :)
+ // It's possible not to care about quadrants as it "just works" as expected
+ ((struct sym_text *) rs->label)->rotate = convert_to_deg(atan(rs->slope));
+ }
+ else
+ {
+ rs->slope = 142; // Magic!
+ ((struct sym_text *) rs->label)->rotate = 1;
+ }
struct variant *v = GARY_PUSH(rs->request.variants);
make_bitmap(v, rs->label);