diff options
author | Michael Henning <drawoc@darkrefraction.com> | 2013-11-18 18:39:45 -0500 |
---|---|---|
committer | Mikael Magnusson <mikachu@src.gnome.org> | 2015-02-27 19:13:58 +0100 |
commit | 2e831f0eaf20a90f7f70cc16e77e61e6f8268e25 (patch) | |
tree | 781263391d06f737d40018e2e5bf112a0ccaf910 /libs | |
parent | 4d7f602f2342790a637f0befd768245a11e4c8a5 (diff) |
npd: Mark some functions as static.
Diffstat (limited to 'libs')
-rw-r--r-- | libs/npd/deformation.c | 64 | ||||
-rw-r--r-- | libs/npd/deformation.h | 18 | ||||
-rw-r--r-- | libs/npd/graphics.h | 4 | ||||
-rw-r--r-- | libs/npd/lattice_cut.c | 2 | ||||
-rw-r--r-- | libs/npd/lattice_cut.h | 12 |
5 files changed, 38 insertions, 62 deletions
diff --git a/libs/npd/deformation.c b/libs/npd/deformation.c index caa5496c..d8af889a 100644 --- a/libs/npd/deformation.c +++ b/libs/npd/deformation.c @@ -22,7 +22,7 @@ #include "deformation.h" #include <math.h> -void +static void npd_compute_centroid_of_overlapping_points (gint num_of_points, NPDPoint *points[], gfloat weights[], @@ -45,7 +45,7 @@ npd_compute_centroid_of_overlapping_points (gint num_of_points, centroid->y = y_sum / weights_sum; } -void +static void npd_compute_centroid_from_weighted_points (gint num_of_points, NPDPoint points[], gfloat weights[], @@ -67,7 +67,7 @@ npd_compute_centroid_from_weighted_points (gint num_of_points, centroid->y = y_sum / weights_sum; } -void +static void npd_compute_ARSAP_transformation (gint num_of_points, NPDPoint reference_points[], NPDPoint current_points[], @@ -139,7 +139,7 @@ npd_compute_ARSAP_transformation (gint num_of_points, } } -void +static void npd_compute_ARSAP_transformations (NPDHiddenModel *hidden_model) { gint i; @@ -156,18 +156,34 @@ npd_compute_ARSAP_transformations (NPDHiddenModel *hidden_model) } } -void -npd_deform_model (NPDModel *model, - gint rigidity) +static void +npd_deform_hidden_model_once (NPDHiddenModel *hidden_model) { - gint i; - for (i = 0; i < rigidity; ++i) + gint i, j; + npd_compute_ARSAP_transformations (hidden_model); + + /* overlapping points are not overlapping after the deformation, + so we have to move them to their centroid */ + for (i = 0; i < hidden_model->num_of_overlapping_points; ++i) { - npd_deform_model_once (model); + NPDOverlappingPoints *list_of_ops + = &hidden_model->list_of_overlapping_points[i]; + NPDPoint centroid; + + npd_compute_centroid_of_overlapping_points (list_of_ops->num_of_points, + list_of_ops->points, + NULL, + ¢roid); + + for (j = 0; j < list_of_ops->num_of_points; ++j) + { + list_of_ops->points[j]->x = centroid.x; + list_of_ops->points[j]->y = centroid.y; + } } } -void +static void npd_deform_model_once (NPDModel *model) { gint i, j; @@ -190,28 +206,12 @@ npd_deform_model_once (NPDModel *model) } void -npd_deform_hidden_model_once (NPDHiddenModel *hidden_model) +npd_deform_model (NPDModel *model, + gint rigidity) { - gint i, j; - npd_compute_ARSAP_transformations (hidden_model); - - /* overlapping points are not overlapping after the deformation, - so we have to move them to their centroid */ - for (i = 0; i < hidden_model->num_of_overlapping_points; ++i) + gint i; + for (i = 0; i < rigidity; ++i) { - NPDOverlappingPoints *list_of_ops - = &hidden_model->list_of_overlapping_points[i]; - NPDPoint centroid; - - npd_compute_centroid_of_overlapping_points (list_of_ops->num_of_points, - list_of_ops->points, - NULL, - ¢roid); - - for (j = 0; j < list_of_ops->num_of_points; ++j) - { - list_of_ops->points[j]->x = centroid.x; - list_of_ops->points[j]->y = centroid.y; - } + npd_deform_model_once (model); } } diff --git a/libs/npd/deformation.h b/libs/npd/deformation.h index c363e1d8..171f968d 100644 --- a/libs/npd/deformation.h +++ b/libs/npd/deformation.h @@ -24,25 +24,7 @@ #include "npd_common.h" -void npd_compute_centroid_from_weighted_points - (gint num_of_points, - NPDPoint points[], - gfloat weights[], - NPDPoint *centroid); -void npd_compute_centroid_of_overlapping_points - (gint num_of_points, - NPDPoint *points[], - gfloat weights[], - NPDPoint *centroid); -void npd_compute_ARSAP_transformation (gint num_of_points, - NPDPoint reference_shape[], - NPDPoint current_shape[], - gfloat weights[], - gboolean ASAP); -void npd_compute_ARSAP_transformations (NPDHiddenModel *model); void npd_deform_model (NPDModel *model, gint rigidity); -void npd_deform_model_once (NPDModel *model); -void npd_deform_hidden_model_once (NPDHiddenModel *hidden_model); #endif /* __NPD_DEFORMATION_H__ */ diff --git a/libs/npd/graphics.h b/libs/npd/graphics.h index db174fc8..457ac80b 100644 --- a/libs/npd/graphics.h +++ b/libs/npd/graphics.h @@ -59,10 +59,8 @@ void npd_draw_model (NPDModel *model, void npd_draw_mesh (NPDModel *model, NPDDisplay *display); -gboolean npd_load_image (NPDImage *image, - const char *path); void npd_destroy_image (NPDImage *image); -//void npd_draw_image (NPDImage *image); + void npd_texture_fill_triangle (gint x1, gint y1, gint x2, diff --git a/libs/npd/lattice_cut.c b/libs/npd/lattice_cut.c index d8e7f72e..5bd75928 100644 --- a/libs/npd/lattice_cut.c +++ b/libs/npd/lattice_cut.c @@ -28,7 +28,7 @@ #define NPD_SWAP_INTS(i,j) { gint tmp = i; i = j; j = tmp; } /* only works for straight lines */ -gboolean +static gboolean npd_is_edge_empty (NPDImage *image, gint X1, gint Y1, diff --git a/libs/npd/lattice_cut.h b/libs/npd/lattice_cut.h index b331ba35..073c37ee 100644 --- a/libs/npd/lattice_cut.h +++ b/libs/npd/lattice_cut.h @@ -19,22 +19,18 @@ * Copyright (C) 2013 Marek Dvoroznak <dvoromar@gmail.com> */ -#ifndef __REFINE_H__ -#define __REFINE_H__ +#ifndef __LATTICE_CUT_H__ +#define __LATTICE_CUT_H__ #include "npd_common.h" -gboolean npd_is_edge_empty (NPDImage *image, - gint X1, - gint Y1, - gint X2, - gint Y2); GList** npd_find_edges (NPDImage *image, gint count_x, gint count_y, gint square_size); + GList* npd_cut_edges (GList **edges, gint ow, gint oh); -#endif /* __REFINE_H__ */ +#endif /* __LATTICE_CUT_H__ */ |