RadialDeadzoneStrategy Class
Implements a radial (circular) deadzone strategy for analog stick normalization. More...
Declaration
Base class
| class | DeadzoneStrategy |
|
Abstract strategy interface for normalizing gamepad stick input with deadzone handling. More... | |
Public Constructors Index
| RadialDeadzoneStrategy () | |
|
Default constructor. More... | |
| RadialDeadzoneStrategy (float stickNoiseThreshold) | |
|
Interface for applying deadzone handling to gamepad stick input. More... | |
Public Member Functions Index
| void | normalize (float deadzone, float &x, float &y) const noexcept override |
|
Applies radial deadzone normalization to stick input. More... | |
Description
Implements a radial (circular) deadzone strategy for analog stick normalization.
This strategy treats the deadzone as a circle centered at the origin. Input vectors with a magnitude less than or equal to the deadzone threshold are zeroed out completely. Input vectors exceeding the deadzone are rescaled so that the effective input range starts at the edge of the deadzone circle, providing a smooth and consistent response.
The radial approach is generally preferred over axial deadzones because it eliminates diagonal movement artifacts and provides uniform sensitivity in all directions.
**Algorithm:** 1. Calculate the magnitude (length) of the input vector. 2. If magnitude <= deadzone, set both axes to zero. 3. If magnitude > 1.0, normalize the vector to unit length. 4. Rescale the magnitude from [deadzone, 1.0] to [0.0, 1.0]. 5. Apply the rescaled magnitude to the normalized direction vector.
- See Also
DeadzoneStrategy for the abstract interface.
Definition at line 37 of file RadialDeadzoneStrategy.ixx.
Public Constructors
RadialDeadzoneStrategy()
| inline |
Default constructor.
Definition at line 44 of file RadialDeadzoneStrategy.ixx.
Reference helios::input::gamepad::DeadzoneStrategy::DeadzoneStrategy.
RadialDeadzoneStrategy()
| inline |
Interface for applying deadzone handling to gamepad stick input.
Defines a method for processing and normalizing analog stick input while accounting for a deadzone. A deadzone eliminates unintended small input values caused by hardware imperfections. Implementations of this interface provide specific strategies for handling the deadzone and input normalization.
- See Also
AxisDeadzoneStrategy for an axis-aligned deadzone implementation.
Definition at line 49 of file RadialDeadzoneStrategy.ixx.
References helios::input::gamepad::DeadzoneStrategy::DeadzoneStrategy and helios::input::gamepad::DeadzoneStrategy::stickNoiseThreshold.
Public Member Functions
normalize()
| inline noexcept virtual |
Applies radial deadzone normalization to stick input.
Modifies the input coordinates in-place. Values within the circular deadzone are zeroed, while values outside are rescaled for a smooth response curve.
- Parameters
-
deadzone The deadzone radius threshold in the range [0.0, 1.0].
x Reference to the x-axis value, modified in-place.
y Reference to the y-axis value, modified in-place.
Definition at line 61 of file RadialDeadzoneStrategy.ixx.
Reference helios::input::gamepad::DeadzoneStrategy::stickNoiseThreshold.
The documentation for this class was generated from the following file:
Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.