26template<
size_t pixelCount>
34 uint16_t
up[pixelCount];
79 bool GetUpIndex(uint16_t count, uint16_t* upIndex)
override;
88 bool GetRadialIndex(uint16_t count, uint16_t* index,
int pixels,
float angle)
override;
Declares the IPixelGroup interface for managing collections of pixels.
Represents a 2D axis-aligned bounding box.
Interface for managing and interacting with a collection of pixels.
Direction
Specifies traversal directions for pixels.
@ ZEROTOMAX
Traverse from minimum to maximum indices.
Manages a collection of pixels with positions, colors, and spatial relationships.
bool GetRadialIndex(uint16_t count, uint16_t *index, int pixels, float angle) override
Retrieves a radial index for a given pixel based on distance and angle.
RGBColor * GetColors() override
Retrieves the array of colors for the pixel group.
void GridSort() override
Sorts the pixels in a grid structure.
bool GetOffsetXYIndex(uint16_t count, uint16_t *index, int x1, int y1) override
Retrieves an offset XY-axis index for a given pixel.
uint16_t down[pixelCount]
Indices of pixels below each pixel.
uint16_t colCount
Number of columns in the grid.
uint16_t GetPixelCount() override
Retrieves the total number of pixels in the group.
uint16_t right[pixelCount]
Indices of pixels to the right of each pixel.
Vector2D position
Position of the grid.
bool GetUpIndex(uint16_t count, uint16_t *upIndex) override
Retrieves the index of the pixel above a given pixel.
RGBColor * GetColor(uint16_t count) override
Retrieves the color of a specific pixel.
RGBColor pixelBuffer[pixelCount]
Array of color buffers for temporary use.
PixelGroup(Vector2D size, Vector2D position, uint16_t rowCount)
Constructs a rectangular PixelGroup.
Direction direction
Direction of pixel traversal.
bool GetAlternateXIndex(uint16_t count, uint16_t *index) override
Retrieves an alternate X-axis index for a given pixel.
int GetPixelIndex(Vector2D location) override
Retrieves the index of a pixel at a specific location.
bool Overlaps(BoundingBox2D *box) override
Checks if the pixel group overlaps with a bounding box.
RGBColor pixelColors[pixelCount]
Array of pixel colors.
bool GetLeftIndex(uint16_t count, uint16_t *leftIndex) override
Retrieves the index of the pixel to the left of a given pixel.
Vector2D GetCoordinate(uint16_t count) override
Retrieves the coordinate of a specific pixel.
uint16_t rowCount
Number of rows in the grid.
bool GetDownIndex(uint16_t count, uint16_t *downIndex) override
Retrieves the index of the pixel below a given pixel.
const Vector2D * pixelPositions
Array of pixel positions.
bool ContainsVector2D(Vector2D v) override
Checks if the pixel group contains a specific vector.
Vector2D tempLocation
Temporary location for calculations.
bool GetOffsetXIndex(uint16_t count, uint16_t *index, int x1) override
Retrieves an offset X-axis index for a given pixel.
uint16_t left[pixelCount]
Indices of pixels to the left of each pixel.
bool GetRightIndex(uint16_t count, uint16_t *rightIndex) override
Retrieves the index of the pixel to the right of a given pixel.
PixelGroup(const Vector2D *pixelLocations, Direction direction=ZEROTOMAX)
Constructs a PixelGroup from arbitrary pixel locations.
bool GetOffsetYIndex(uint16_t count, uint16_t *index, int y1) override
Retrieves an offset Y-axis index for a given pixel.
Vector2D GetCenterCoordinate() override
Retrieves the center coordinate of the pixel group.
uint16_t up[pixelCount]
Indices of pixels above each pixel.
RGBColor * GetColorBuffer() override
Retrieves the color buffer for the pixel group.
~PixelGroup()
Destroys the PixelGroup object.
bool isRectangular
Indicates if the group forms a rectangular grid.
Vector2D GetSize() override
Retrieves the size of the pixel group.
BoundingBox2D bounds
Bounding box for the pixel group.
Vector2D size
Size of the grid.
bool GetAlternateYIndex(uint16_t count, uint16_t *index) override
Retrieves an alternate Y-axis index for a given pixel.
Represents an RGB color and provides methods for manipulation.
Represents a 2D vector (X, Y) and provides methods for vector arithmetic.