17 float halfWidth = 48.0f;
30 float r = distance / halfWidth;
31 float theta = atan2(dif.
Y, dif.
X);
34 int offsetX = (int)(newDistance * cosf(theta));
35 int offsetY = (int)(newDistance * sinf(theta));
39 colorBuffer[i].
R = pixelColors[tIndex].
R;
40 colorBuffer[i].
G = pixelColors[tIndex].
G;
41 colorBuffer[i].
B = pixelColors[tIndex].
B;
50 pixelColors[i].
R = colorBuffer[i].
R;
51 pixelColors[i].
G = colorBuffer[i].
G;
52 pixelColors[i].
B = colorBuffer[i].
B;
Defines the Fisheye effect class for applying fisheye distortions to pixel groups.
float ratio
A scaling ratio used for dynamic effect adjustments.
Fisheye(float amplitude=0.5f)
Constructs a Fisheye effect with a specified amplitude.
FunctionGenerator fGenX
Controls X-axis displacement.
float amplitude
Amplitude of the distortion effect.
void SetAmplitude(float amplitude)
Sets the amplitude of the distortion.
void SetPosition(Vector2D offset)
Sets the distortion center offset.
void ApplyEffect(IPixelGroup *pixelGroup) override
Applies the fisheye effect to the given pixel group.
FunctionGenerator fGenWarp
Controls warp effect.
Vector2D offset
Offset for the fisheye distortion center.
FunctionGenerator fGenY
Controls Y-axis displacement.
float Update()
Updates and calculates the next value of the waveform.
Interface for managing and interacting with a collection of pixels.
virtual RGBColor * GetColors()=0
Retrieves the array of colors for the pixel group.
virtual RGBColor * GetColorBuffer()=0
Retrieves the color buffer for the pixel group.
virtual Vector2D GetCoordinate(uint16_t count)=0
Retrieves the coordinate of a specific pixel.
virtual bool GetOffsetXYIndex(uint16_t count, uint16_t *index, int x1, int y1)=0
Retrieves an offset XY-axis index for a given pixel.
virtual uint16_t GetPixelCount()=0
Retrieves the total number of pixels in the group.
virtual Vector2D GetCenterCoordinate()=0
Retrieves the center coordinate of the pixel group.
Represents an RGB color and provides methods for manipulation.
uint8_t B
Blue component of the color (0-255).
uint8_t G
Green component of the color (0-255).
uint8_t R
Red component of the color (0-255).
Represents a 2D vector (X, Y) and provides methods for vector arithmetic.
float CalculateEuclideanDistance(const Vector2D &vector) const
Calculates the Euclidean distance between this vector and another Vector2D.
float X
The X-component of the 2D vector.
float Y
The Y-component of the 2D vector.