2 * ***** BEGIN GPL LICENSE BLOCK *****
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software Foundation,
16 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * ***** END GPL LICENSE BLOCK *****
21 #ifndef __BLI_DIAL_2D_H__
22 #define __BLI_DIAL_2D_H__
24 /** \file BLI_dial_2d.h
27 * \note dials act similar to old rotation based phones and output an angle.
29 * They just are initialized with the center of the dial and a threshold value as input.
31 * When the distance of the current position of the dial from the center
32 * exceeds the threshold, this position is used to calculate the initial direction.
33 * After that, the angle from the initial direction is calculated based on
34 * current and previous directions of the digit, and returned to the user.
39 * float start_position[2] = {0.0f, 0.0f};
40 * float current_position[2];
41 * float threshold = 0.5f;
45 * dial = BLI_dial_initialize(start_position, threshold);
47 * angle = BLI_dial_angle(dial, curent_position);
53 typedef struct Dial Dial;
55 Dial *BLI_dial_initialize(const float start_position[2], float threshold);
57 float BLI_dial_angle(Dial *dial, const float current_position[2]);
59 #endif /* __BLI_DIAL_2D_H__ */