Edit trigonometric functions

This commit is contained in:
Mario Hüttel 2018-12-22 19:31:36 +01:00
parent 15ff68ea74
commit a2b83c37a9
3 changed files with 24 additions and 13 deletions

View File

@ -242,8 +242,6 @@ static void on_convert_clicked(gpointer button, gpointer user)
goto ret_layer_destroy; goto ret_layer_destroy;
} }
/* save file dialog */ /* save file dialog */
dialog = gtk_file_chooser_dialog_new((sett.renderer == RENDERER_LATEX_TIKZ dialog = gtk_file_chooser_dialog_new((sett.renderer == RENDERER_LATEX_TIKZ
? "Save LaTeX File" : "Save PDF"), ? "Save LaTeX File" : "Save PDF"),

View File

@ -135,12 +135,26 @@ static void calculate_path_miter_points(struct vector_2d *a, struct vector_2d *b
void bounding_box_calculate_path_box(GList *vertices, conv_generic_to_vector_2d_t conv_func, union bounding_box *box) void bounding_box_calculate_path_box(GList *vertices, conv_generic_to_vector_2d_t conv_func, union bounding_box *box)
{ {
printf("Error! Function bounding_box_calculate_path_box not yet implemented!\n");
} }
void bounding_box_update_point(union bounding_box *destination, conv_generic_to_vector_2d_t conv_func, void *pt) void bounding_box_update_point(union bounding_box *destination, conv_generic_to_vector_2d_t conv_func, void *pt)
{ {
struct vector_2d point;
if (!destination || !pt) {
return;
}
if (!conv_func)
conv_func(pt, &point);
else
(void)vector_2d_copy(&point, (struct vector_2d *)pt);
destination->vectors.lower_left.x = MIN(destination->vectors.lower_left.x, point.x);
destination->vectors.lower_left.y = MIN(destination->vectors.lower_left.y, point.y);
destination->vectors.upper_right.x = MAX(destination->vectors.upper_right.x, point.x);
destination->vectors.upper_right.y = MAX(destination->vectors.upper_right.y, point.y);
} }
/** @} */ /** @} */

View File

@ -76,18 +76,17 @@ struct vector_2d *vector_2d_copy(struct vector_2d *opt_res, struct vector_2d *ve
if (!vec) if (!vec)
return NULL; return NULL;
if (opt_res) {
opt_res->x = vec->x; if (opt_res)
opt_res->y = vec->y; res = opt_res;
return opt_res; else
} else {
res = vector_2d_alloc(); res = vector_2d_alloc();
if (res) {
res->x = vec->x; if (res) {
res->y = vec->y; res->x = vec->x;
} res->y = vec->y;
return res;
} }
return res;
} }
struct vector_2d *vector_2d_alloc(void) struct vector_2d *vector_2d_alloc(void)