gegl r2736 - in trunk: . gegl/property-types
- From: ok svn gnome org
- To: svn-commits-list gnome org
- Subject: gegl r2736 - in trunk: . gegl/property-types
- Date: Wed, 12 Nov 2008 23:17:21 +0000 (UTC)
Author: ok
Date: Wed Nov 12 23:17:21 2008
New Revision: 2736
URL: http://svn.gnome.org/viewvc/gegl?rev=2736&view=rev
Log:
* gegl/property-types/gegl-path.[ch]: (path_calc_values): use the same
approach as the stroker when computing the values. Added function to
compute closest point for coordinates.
Modified:
trunk/ChangeLog
trunk/gegl/property-types/gegl-path.c
trunk/gegl/property-types/gegl-path.h
Modified: trunk/gegl/property-types/gegl-path.c
==============================================================================
--- trunk/gegl/property-types/gegl-path.c (original)
+++ trunk/gegl/property-types/gegl-path.c Wed Nov 12 23:17:21 2008
@@ -502,6 +502,11 @@
traveled_length += spacing;
i++;
}
+ if (!iter->next)
+ {
+ xs[num_samples-1]=b.x;
+ ys[num_samples-1]=b.y;
+ }
need_to_travel += distance;
@@ -1510,13 +1515,13 @@
gint closest_val = 0;
gdouble *samples_x;
gdouble *samples_y;
- n = length;
+ n = ceil(length);
samples_x = g_malloc (sizeof (gdouble)* n);
samples_y = g_malloc (sizeof (gdouble)* n);
gegl_path_calc_values (path, n, samples_x, samples_y);
- for (i=0;i<length;i++)
+ for (i=0;i<n;i++)
{
gdouble dist = (samples_x[i]-x) * (samples_x[i]-x) +
(samples_y[i]-y) * (samples_y[i]-y);
Modified: trunk/gegl/property-types/gegl-path.h
==============================================================================
--- trunk/gegl/property-types/gegl-path.h (original)
+++ trunk/gegl/property-types/gegl-path.h Wed Nov 12 23:17:21 2008
@@ -122,11 +122,20 @@
guint num_samples,
gdouble *samples);
-gdouble gegl_path_get_length (GeglPath *self);
+gdouble gegl_path_get_length (GeglPath *path);
+gdouble gegl_path_closest_point (GeglPath *path,
+ gdouble x,
+ gdouble y,
+ gdouble *dx,
+ gdouble *dy);
void gegl_path_calc (GeglPath *path,
gdouble pos,
gdouble *dest_x,
gdouble *dest_y);
+void gegl_path_node (GeglPath *path,
+ gdouble pos,
+ gdouble *dest_x,
+ gdouble *dest_y);
void gegl_path_get_bounds (GeglPath *self,
gdouble *min_x,
gdouble *max_x,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]