}
};
+double convert_to_deg(double rotate_rad);
+double convert_to_rad(double rotate_deg);
+
void compute_sizes(void);
void make_population(void);
return min2(min2(a, b), min2(c, d));
}
+double convert_to_deg(double rotate_rad)
+{
+ return rotate_rad * (-180 / M_PI);
+}
+
+double convert_to_rad(double rotate_deg)
+{
+ return rotate_deg / (-180 / M_PI);
+}
+
void dump_label(struct symbol *sym)
{
switch (sym->type)
int tw = ceil(text->tw);
int th = ceil(text->th);
- double rotate_rad = text->rotate / (-180 / M_PI);
+ double rotate_rad = convert_to_rad(text->rotate);
// Initially, ll = [0; 0], lr = [tw, 0], ul = [0, th], ur = [tw, th]
// They could be declared before but should not be initialized in code
rs->y2 = e->n2->o->y;
rs->slope = (rs->y2 - rs->y1) / (rs->x2 - rs->x1);
- ((struct sym_text *) rs->label)->rotate = atan(rs->slope) * (-180 / M_PI);
+ ((struct sym_text *) rs->label)->rotate = convert_to_deg(atan(rs->slope));
struct variant *v = GARY_PUSH(rs->request.variants);
make_bitmap(v, rs->label);
struct sym_text *st = (struct sym_text *) rs->label;
double width = p->request->variants[p->variant_used].width;
- double rotated_x = p->x + width * sin(st->rotate / (-180 / M_PI));
- double rotated_y = p->y + width * cos(st->rotate / (-180 / M_PI));
+ double rotated_x = p->x + width * sin(convert_to_rad(st->rotate));
+ double rotated_y = p->y + width * cos(convert_to_rad(st->rotate));
if (rs->x1 < rs->x2)
{