[gegl/soc-2013-n-point-deformation: 21/28] libs: npd: add function to get a control point with specified radius at specified position



commit b458e8e101d86ad5c238df162ba3096b1dc9ddc4
Author: Marek Dvoroznak <dvoromar gmail com>
Date:   Mon Aug 26 04:01:06 2013 +0200

    libs: npd: add function to get a control point with specified radius at specified position

 libs/npd/npd_common.c |   17 +++++++++++++----
 libs/npd/npd_common.h |    6 +++++-
 2 files changed, 18 insertions(+), 5 deletions(-)
---
diff --git a/libs/npd/npd_common.c b/libs/npd/npd_common.c
index 81544fc..8592153 100644
--- a/libs/npd/npd_common.c
+++ b/libs/npd/npd_common.c
@@ -263,8 +263,9 @@ npd_equal_coordinates_epsilon (NPDPoint *p1,
 }
 
 NPDControlPoint*
-npd_get_control_point_at (NPDModel *model,
-                          NPDPoint *coord)
+npd_get_control_point_with_radius_at (NPDModel        *model,
+                                      NPDPoint        *coord,
+                                      gfloat           radius)
 {
   gint i;
   for (i = 0; i < model->control_points->len; i++)
@@ -274,16 +275,24 @@ npd_get_control_point_at (NPDModel *model,
                                             i);
       if (npd_equal_coordinates_epsilon (&cp->point,
                                           coord,
-                                          model->control_point_radius))
+                                          radius))
         {
           return cp;
         }
     }
 
-//  g_printf ("no control points\n");
   return NULL;
 }
 
+NPDControlPoint*
+npd_get_control_point_at (NPDModel *model,
+                          NPDPoint *coord)
+{
+  return npd_get_control_point_with_radius_at (model,
+                                               coord,
+                                               model->control_point_radius);
+}
+
 void
 npd_create_list_of_overlapping_points (NPDHiddenModel *hm)
 {
diff --git a/libs/npd/npd_common.h b/libs/npd/npd_common.h
index f4213a0..1fd5b19 100644
--- a/libs/npd/npd_common.h
+++ b/libs/npd/npd_common.h
@@ -81,7 +81,7 @@ typedef struct
 
 typedef struct
 {
-  gint                  control_point_radius;
+  gfloat                control_point_radius;
   gboolean              control_points_visible;
   gboolean              mesh_visible;
   gboolean              texture_visible;
@@ -116,6 +116,10 @@ gboolean         npd_equal_coordinates          (NPDPoint        *p1,
 gboolean         npd_equal_coordinates_epsilon  (NPDPoint        *p1,
                                                  NPDPoint        *p2,
                                                  gfloat           epsilon);
+NPDControlPoint *npd_get_control_point_with_radius_at
+                                                (NPDModel        *model,
+                                                 NPDPoint        *coord,
+                                                 gfloat           control_point_radius);
 NPDControlPoint *npd_get_control_point_at       (NPDModel        *model,
                                                  NPDPoint        *coord);
 void             npd_create_list_of_overlapping_points


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]