ProtoTracer  1.0
Real-time 3D rendering and animation engine
Loading...
Searching...
No Matches
IPixelGroup.h
Go to the documentation of this file.
1/**
2 * @file IPixelGroup.h
3 * @brief Declares the IPixelGroup interface for managing collections of pixels.
4 *
5 * This file defines the IPixelGroup interface, which specifies the contract
6 * for working with groups of pixels, including spatial relationships and color management.
7 *
8 * @date 22/12/2024
9 * @author Coela Can't
10 */
11
12#pragma once
13
14#include "../../Utils/RGBColor.h" // Include for RGB color representation.
15#include "../../Physics/Utils/BoundingBox2D.h" // Include for 2D bounding box representation.
16
17/**
18 * @class IPixelGroup
19 * @brief Interface for managing and interacting with a collection of pixels.
20 *
21 * The IPixelGroup interface provides methods for retrieving pixel properties,
22 * spatial relationships, and color data. Implementations of this interface can
23 * manage rectangular grids or arbitrary pixel arrangements.
24 */
26public:
27 /**
28 * @enum Direction
29 * @brief Specifies traversal directions for pixels.
30 */
31 enum Direction {
32 ZEROTOMAX, ///< Traverse from minimum to maximum indices.
33 MAXTOZERO ///< Traverse from maximum to minimum indices.
34 };
35
36 /**
37 * @brief Retrieves the center coordinate of the pixel group.
38 *
39 * @return The center coordinate as a Vector2D.
40 */
42
43 /**
44 * @brief Retrieves the size of the pixel group.
45 *
46 * @return The size as a Vector2D.
47 */
48 virtual Vector2D GetSize() = 0;
49
50 /**
51 * @brief Retrieves the coordinate of a specific pixel.
52 *
53 * @param count The index of the pixel.
54 * @return The coordinate of the pixel as a Vector2D.
55 */
56 virtual Vector2D GetCoordinate(uint16_t count) = 0;
57
58 /**
59 * @brief Retrieves the index of a pixel at a specific location.
60 *
61 * @param location The location to search for a pixel.
62 * @return The index of the pixel, or -1 if not found.
63 */
64 virtual int GetPixelIndex(Vector2D location) = 0;
65
66 /**
67 * @brief Retrieves the color of a specific pixel.
68 *
69 * @param count The index of the pixel.
70 * @return Pointer to the RGB color of the pixel.
71 */
72 virtual RGBColor* GetColor(uint16_t count) = 0;
73
74 /**
75 * @brief Retrieves the array of colors for the pixel group.
76 *
77 * @return Pointer to the array of RGB colors.
78 */
79 virtual RGBColor* GetColors() = 0;
80
81 /**
82 * @brief Retrieves the color buffer for the pixel group.
83 *
84 * @return Pointer to the color buffer array.
85 */
86 virtual RGBColor* GetColorBuffer() = 0;
87
88 /**
89 * @brief Retrieves the total number of pixels in the group.
90 *
91 * @return The total pixel count.
92 */
93 virtual uint16_t GetPixelCount() = 0;
94
95 /**
96 * @brief Checks if the pixel group overlaps with a bounding box.
97 *
98 * @param box Pointer to the bounding box.
99 * @return True if the group overlaps with the box, otherwise false.
100 */
101 virtual bool Overlaps(BoundingBox2D* box) = 0;
102
103 /**
104 * @brief Checks if the pixel group contains a specific vector.
105 *
106 * @param v The vector to check.
107 * @return True if the group contains the vector, otherwise false.
108 */
109 virtual bool ContainsVector2D(Vector2D v) = 0;
110
111 /**
112 * @brief Retrieves the index of the pixel above a given pixel.
113 *
114 * @param count The index of the current pixel.
115 * @param upIndex Pointer to store the index of the pixel above.
116 * @return True if a pixel above exists, otherwise false.
117 */
118 virtual bool GetUpIndex(uint16_t count, uint16_t* upIndex) = 0;
119
120 /**
121 * @brief Retrieves the index of the pixel below a given pixel.
122 *
123 * @param count The index of the current pixel.
124 * @param downIndex Pointer to store the index of the pixel below.
125 * @return True if a pixel below exists, otherwise false.
126 */
127 virtual bool GetDownIndex(uint16_t count, uint16_t* downIndex) = 0;
128
129 /**
130 * @brief Retrieves the index of the pixel to the left of a given pixel.
131 *
132 * @param count The index of the current pixel.
133 * @param leftIndex Pointer to store the index of the pixel to the left.
134 * @return True if a pixel to the left exists, otherwise false.
135 */
136 virtual bool GetLeftIndex(uint16_t count, uint16_t* leftIndex) = 0;
137
138 /**
139 * @brief Retrieves the index of the pixel to the right of a given pixel.
140 *
141 * @param count The index of the current pixel.
142 * @param rightIndex Pointer to store the index of the pixel to the right.
143 * @return True if a pixel to the right exists, otherwise false.
144 */
145 virtual bool GetRightIndex(uint16_t count, uint16_t* rightIndex) = 0;
146
147 /**
148 * @brief Retrieves an alternate X-axis index for a given pixel.
149 *
150 * @param count The index of the current pixel.
151 * @param index Pointer to store the alternate X index.
152 * @return True if an alternate index exists, otherwise false.
153 */
154 virtual bool GetAlternateXIndex(uint16_t count, uint16_t* index) = 0;
155
156 /**
157 * @brief Retrieves an alternate Y-axis index for a given pixel.
158 *
159 * @param count The index of the current pixel.
160 * @param index Pointer to store the alternate Y index.
161 * @return True if an alternate index exists, otherwise false.
162 */
163 virtual bool GetAlternateYIndex(uint16_t count, uint16_t* index) = 0;
164
165 /**
166 * @brief Retrieves an offset X-axis index for a given pixel.
167 *
168 * @param count The index of the current pixel.
169 * @param index Pointer to store the offset X index.
170 * @param x1 The X-axis offset value.
171 * @return True if an offset index exists, otherwise false.
172 */
173 virtual bool GetOffsetXIndex(uint16_t count, uint16_t* index, int x1) = 0;
174
175 /**
176 * @brief Retrieves an offset Y-axis index for a given pixel.
177 *
178 * @param count The index of the current pixel.
179 * @param index Pointer to store the offset Y index.
180 * @param y1 The Y-axis offset value.
181 * @return True if an offset index exists, otherwise false.
182 */
183 virtual bool GetOffsetYIndex(uint16_t count, uint16_t* index, int y1) = 0;
184
185 /**
186 * @brief Retrieves an offset XY-axis index for a given pixel.
187 *
188 * @param count The index of the current pixel.
189 * @param index Pointer to store the offset XY index.
190 * @param x1 The X-axis offset value.
191 * @param y1 The Y-axis offset value.
192 * @return True if an offset index exists, otherwise false.
193 */
194 virtual bool GetOffsetXYIndex(uint16_t count, uint16_t* index, int x1, int y1) = 0;
195
196 /**
197 * @brief Retrieves a radial index for a given pixel based on distance and angle.
198 *
199 * @param count The index of the current pixel.
200 * @param index Pointer to store the radial index.
201 * @param pixels The radial distance in pixels.
202 * @param angle The angle in degrees.
203 * @return True if a radial index exists, otherwise false.
204 */
205 virtual bool GetRadialIndex(uint16_t count, uint16_t* index, int pixels, float angle) = 0;
206
207 /**
208 * @brief Sorts the pixels in a grid structure.
209 */
210 virtual void GridSort() = 0;
211};
Represents a 2D axis-aligned bounding box.
Interface for managing and interacting with a collection of pixels.
Definition IPixelGroup.h:25
virtual RGBColor * GetColors()=0
Retrieves the array of colors for the pixel group.
virtual void GridSort()=0
Sorts the pixels in a grid structure.
virtual RGBColor * GetColorBuffer()=0
Retrieves the color buffer for the pixel group.
virtual bool GetLeftIndex(uint16_t count, uint16_t *leftIndex)=0
Retrieves the index of the pixel to the left of a given pixel.
Direction
Specifies traversal directions for pixels.
Definition IPixelGroup.h:31
@ ZEROTOMAX
Traverse from minimum to maximum indices.
Definition IPixelGroup.h:32
@ MAXTOZERO
Traverse from maximum to minimum indices.
Definition IPixelGroup.h:33
virtual int GetPixelIndex(Vector2D location)=0
Retrieves the index of a pixel at a specific location.
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 bool ContainsVector2D(Vector2D v)=0
Checks if the pixel group contains a specific vector.
virtual RGBColor * GetColor(uint16_t count)=0
Retrieves the color of a specific pixel.
virtual bool GetRightIndex(uint16_t count, uint16_t *rightIndex)=0
Retrieves the index of the pixel to the right of a given pixel.
virtual Vector2D GetSize()=0
Retrieves the size of the pixel group.
virtual bool GetAlternateYIndex(uint16_t count, uint16_t *index)=0
Retrieves an alternate Y-axis index for a given pixel.
virtual uint16_t GetPixelCount()=0
Retrieves the total number of pixels in the group.
virtual bool GetRadialIndex(uint16_t count, uint16_t *index, int pixels, float angle)=0
Retrieves a radial index for a given pixel based on distance and angle.
virtual bool Overlaps(BoundingBox2D *box)=0
Checks if the pixel group overlaps with a bounding box.
virtual bool GetUpIndex(uint16_t count, uint16_t *upIndex)=0
Retrieves the index of the pixel above a given pixel.
virtual bool GetOffsetXIndex(uint16_t count, uint16_t *index, int x1)=0
Retrieves an offset X-axis index for a given pixel.
virtual bool GetOffsetYIndex(uint16_t count, uint16_t *index, int y1)=0
Retrieves an offset Y-axis index for a given pixel.
virtual bool GetAlternateXIndex(uint16_t count, uint16_t *index)=0
Retrieves an alternate X-axis index for a given pixel.
virtual bool GetDownIndex(uint16_t count, uint16_t *downIndex)=0
Retrieves the index of the pixel below a given pixel.
virtual Vector2D GetCenterCoordinate()=0
Retrieves the center coordinate of the pixel group.
Represents an RGB color and provides methods for manipulation.
Definition RGBColor.h:23
Represents a 2D vector (X, Y) and provides methods for vector arithmetic.
Definition Vector2D.h:27