RSS/Atom feed Twitter
Site is read-only, email is disabled

Refactoring path_calc_values

This discussion is connected to the gegl-developer-list.gnome.org mailing list which is provided by the GIMP developers and not related to gimpusers.com.

This is a read-only list on gimpusers.com so this discussion thread is read-only, too.

3 of 3 messages available
Toggle history

Please log in to manage your subscriptions.

Refactoring path_calc_values Damien de Lemeny-Makedone 30 May 05:32
  Refactoring path_calc_values Damien de Lemeny-Makedone 30 May 23:27
   Refactoring path_calc_values Damien de Lemeny-Makedone 31 May 18:30
Damien de Lemeny-Makedone
2010-05-30 05:32:31 UTC (over 14 years ago)

Refactoring path_calc_values

Hi dear gegl developers :),

I have a proposition to refactor [gegl_]path_calc_values :

static void path_calc_values (GeglPathList *path, + gdouble pos_min, + gdouble pos_max, guint num_samples, gdouble *xs, gdouble *ys)

This modification is consistent with gegl_curve_calc_values which can return a windowed lookup table.
The refactoring merge redundant code (path_calc and path_calc_values). It also fixed what appeared to me as a bug : offset value was just dropped in the 'M' case, which could lead to a noticeable rounding error.

See attached patch : [PATCH] Refactor [gegl_]path_calc_values

* moded gegl/property-types/gegl-path.[c|h] Add pos_min and pos_max parameters to get sample points on an arbitrary portion of the path
This reduces code and should be very useful to extract gegl_path_stroke in a proper operation.

I did not build a test case yet (if anyone has such code and is willing to share, i'd be grateful).

Please review. Regards.

Damien

Damien de Lemeny-Makedone
2010-05-30 23:27:20 UTC (over 14 years ago)

Refactoring path_calc_values

Another way to go : give a sorted array of positions to compute along the path.

static void path_calc_values_by_position (GeglPathList *path, gdouble *pos_samples, guint num_samples, gdouble *xs, gdouble *ys)

In the case of brush strokes, that would particularly fit spacing dynamics, and other cases which requires computing unevenly distributed points along the path.
It could also be applied to curves

use case : compute_paint_dabs_positions (spacing_curve, n_dabs, dabs_pos); gegl_path_calc_by_pos (path, dabs_pos, n_dabs, xs, ys); gegl_curve_calc_by_pos (size_curve, dabs_pos, n_dabs, dabs_sizes); ...
for (i=0; i
stamp (buffer, stamp_buffer, dabs_pos[i], dabs_sizes[i], ...);

Attached patch obsoletes the previous one.

Regards.

Damien

Damien de Lemeny-Makedone
2010-05-31 18:30:31 UTC (over 14 years ago)

Refactoring path_calc_values

Patch to add tests for GeglPath, current implementation of gegl_path_calc_values fails.

Damien