1 /*****************************************************************************
2 * puzzle_bezier.h : Bezier curves management
3 *****************************************************************************
4 * Copyright (C) 2013 Vianney Boyer
7 * Author: Vianney Boyer <vlcvboyer -at- gmail -dot- com>
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU Lesser General Public License as published by
11 * the Free Software Foundation; either version 2.1 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public License
20 * along with this program; if not, write to the Free Software Foundation,
21 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22 *****************************************************************************/
24 #ifndef VLC_LIB_BEZIER_H
25 #define VLC_LIB_BEZIER_H 1
31 point_t *puzzle_scale_curve_H(int32_t i_width, int32_t i_lines, uint8_t i_pts_nbr, point_t *ps_pt, int32_t i_shape_size);
32 point_t *puzzle_H_2_scale_curve_V(int32_t i_width, int32_t i_lines, uint8_t i_pts_nbr, point_t *ps_pt, int32_t i_shape_size);
33 point_t *puzzle_curve_H_2_V(uint8_t i_pts_nbr, point_t *ps_pt);
34 point_t *puzzle_curve_H_2_negative(uint8_t i_pts_nbr, point_t *ps_pt);
35 point_t *puzzle_curve_V_2_negative(uint8_t i_pts_nbr, point_t *ps_pt);
36 point_t *puzzle_rand_bezier(uint8_t i_pts_nbr);
38 #define bezier_val(ps_pt,f_sub_t,i_main_t,axis) (( 1 - (f_sub_t)) * ( 1 - (f_sub_t) ) * ( 1 - (f_sub_t) ) * ps_pt[ 3 * (i_main_t) ].f_ ## axis \
39 + 3 * (f_sub_t) * ( 1 - (f_sub_t) ) * ( 1 - (f_sub_t) ) * ps_pt[ 3 * (i_main_t) + 1 ].f_ ## axis \
40 + 3 * (f_sub_t) * (f_sub_t) * ( 1 - (f_sub_t) ) * ps_pt[ 3 * (i_main_t) + 2 ].f_ ## axis \
41 + (f_sub_t) * (f_sub_t) * (f_sub_t) * ps_pt[ 3 * (i_main_t) + 3 ].f_ ## axis )