Commit 2e831f0e authored by Michael Henning's avatar Michael Henning Committed by Mikael Magnusson

npd: Mark some functions as static.

parent 4d7f602f
......@@ -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,
&centroid);
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,
&centroid);
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);
}
}
......@@ -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__ */
......@@ -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,
......
......@@ -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,
......
......@@ -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__ */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment