Blender  V3.3
Typedefs | Functions
BLI_dial_2d.h File Reference

Go to the source code of this file.

Typedefs

typedef struct Dial Dial
 

Functions

DialBLI_dial_init (const float start_position[2], float threshold)
 
float BLI_dial_angle (Dial *dial, const float current_position[2])
 

Detailed Description

Note
dials act similar to old rotation based phones and output an angle.

They just are initialized with the center of the dial and a threshold value as input.

When the distance of the current position of the dial from the center exceeds the threshold, this position is used to calculate the initial direction. After that, the angle from the initial direction is calculated based on current and previous directions of the digit, and returned to the user.

Usage examples:

float start_position[2] = {0.0f, 0.0f};
float current_position[2];
float threshold = 0.5f;
float angle;
Dial *dial;
dial = BLI_dial_init(start_position, threshold);
angle = BLI_dial_angle(dial, current_position);
MEM_freeN(dial);
Dial * BLI_dial_init(const float start_position[2], float threshold)
Definition: BLI_dial_2d.c:34
float BLI_dial_angle(Dial *dial, const float current_position[2])
Definition: BLI_dial_2d.c:44
SIMD_FORCE_INLINE btScalar angle(const btVector3 &v) const
Return the angle between this and another vector.
Definition: btVector3.h:356
ccl_gpu_kernel_postfix ccl_global float int int int int float threshold
void(* MEM_freeN)(void *vmemh)
Definition: mallocn.c:27

Definition in file BLI_dial_2d.h.

Typedef Documentation

◆ Dial

typedef struct Dial Dial

Definition at line 1 of file BLI_dial_2d.h.

Function Documentation

◆ BLI_dial_angle()

float BLI_dial_angle ( Dial dial,
const float  current_position[2] 
)

◆ BLI_dial_init()

Dial* BLI_dial_init ( const float  start_position[2],
float  threshold 
)