diff options
author | Campbell Barton <ideasman42@gmail.com> | 2016-07-25 07:12:17 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2016-07-25 07:55:08 +0300 |
commit | 2418daede5913c54bd9675eb23624487f6b0ad4c (patch) | |
tree | b3759b8bc89833aa4b8883d9690874e16a5c9bac /extern/curve_fit_nd/curve_fit_nd.h | |
parent | f23fecf3061a63d24815a63a378a636832a40ccd (diff) |
Curve Fitting: Add alternate 'refit' method
This is an alternative method for fitting a curve which incrementally simplifies the curve, then re-fits.
Generally gives better results, also improves corner detection.
Diffstat (limited to 'extern/curve_fit_nd/curve_fit_nd.h')
-rw-r--r-- | extern/curve_fit_nd/curve_fit_nd.h | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/extern/curve_fit_nd/curve_fit_nd.h b/extern/curve_fit_nd/curve_fit_nd.h index 3649802a425..cfb1881fe00 100644 --- a/extern/curve_fit_nd/curve_fit_nd.h +++ b/extern/curve_fit_nd/curve_fit_nd.h @@ -86,6 +86,7 @@ int curve_fit_cubic_to_points_fl( * * \param points, points_len: The array of points to calculate a cubics from. * \param dims: The number of dimensions for for each element in \a points. + * \param points_length_cache: Optional pre-calculated lengths between points. * \param error_threshold: the error threshold to allow for, * \param tan_l, tan_r: Normalized tangents the handles will be aligned to. * Note that tangents must both point along the direction of the \a points, @@ -98,6 +99,7 @@ int curve_fit_cubic_to_points_fl( int curve_fit_cubic_to_points_single_db( const double *points, const unsigned int points_len, + const double *points_length_cache, const unsigned int dims, const double error_threshold, const double tan_l[], @@ -110,6 +112,7 @@ int curve_fit_cubic_to_points_single_db( int curve_fit_cubic_to_points_single_fl( const float *points, const unsigned int points_len, + const float *points_length_cache, const unsigned int dims, const float error_threshold, const float tan_l[], @@ -121,8 +124,40 @@ int curve_fit_cubic_to_points_single_fl( enum { CURVE_FIT_CALC_HIGH_QUALIY = (1 << 0), + CURVE_FIT_CALC_CYCLIC = (1 << 1), }; + +/* curve_fit_cubic_refit.c */ + +int curve_fit_cubic_to_points_refit_db( + const double *points, + const unsigned int points_len, + const unsigned int dims, + const double error_threshold, + const unsigned int calc_flag, + const unsigned int *corners, + unsigned int corners_len, + const double corner_angle, + + double **r_cubic_array, unsigned int *r_cubic_array_len, + unsigned int **r_cubic_orig_index, + unsigned int **r_corner_index_array, unsigned int *r_corner_index_len); + +int curve_fit_cubic_to_points_refit_fl( + const float *points, + const unsigned int points_len, + const unsigned int dims, + const float error_threshold, + const unsigned int calc_flag, + const unsigned int *corners, + unsigned int corners_len, + const float corner_angle, + + float **r_cubic_array, unsigned int *r_cubic_array_len, + unsigned int **r_cubic_orig_index, + unsigned int **r_corner_index_array, unsigned int *r_corner_index_len); + /* curve_fit_corners_detect.c */ /** |