ProtoTracer  1.0
Real-time 3D rendering and animation engine
Loading...
Searching...
No Matches
Pixel Class Reference

Represents a pixel in a 2D grid with positional, color, and neighbor information. More...

#include <Pixel.h>

Collaboration diagram for Pixel:

Public Member Functions

 Pixel ()
 Default constructor.
 
 Pixel (const Vector2D *position)
 Constructs a Pixel object with a specified position.
 
const Vector2D GetPosition ()
 Retrieves the pixel's position.
 
void SetUpPixel (Pixel *pixel)
 Sets the pixel above this pixel.
 
void SetDownPixel (Pixel *pixel)
 Sets the pixel below this pixel.
 
void SetLeftPixel (Pixel *pixel)
 Sets the pixel to the left of this pixel.
 
void SetRightPixel (Pixel *pixel)
 Sets the pixel to the right of this pixel.
 
bool HasUpPixel ()
 Checks if a pixel exists above this pixel.
 
bool HasDownPixel ()
 Checks if a pixel exists below this pixel.
 
bool HasLeftPixel ()
 Checks if a pixel exists to the left of this pixel.
 
bool HasRightPixel ()
 Checks if a pixel exists to the right of this pixel.
 
PixelGetUpPixel ()
 Retrieves the pixel above this pixel.
 
PixelGetDownPixel ()
 Retrieves the pixel below this pixel.
 
PixelGetLeftPixel ()
 Retrieves the pixel to the left of this pixel.
 
PixelGetRightPixel ()
 Retrieves the pixel to the right of this pixel.
 

Public Attributes

RGBColorColor
 Pointer to the RGB color of the pixel.
 

Private Attributes

const Vector2Dposition
 Pointer to the pixel's position in 2D space.
 
bool sorted = false
 Indicates whether the pixel has been processed in sorting algorithms.
 
bool upExists = false
 Indicates if a pixel exists above this pixel.
 
bool downExists = false
 Indicates if a pixel exists below this pixel.
 
bool leftExists = false
 Indicates if a pixel exists to the left of this pixel.
 
bool rightExists = false
 Indicates if a pixel exists to the right of this pixel.
 
Pixelup = nullptr
 Pointer to the pixel above this pixel.
 
Pixeldown = nullptr
 Pointer to the pixel below this pixel.
 
Pixelleft = nullptr
 Pointer to the pixel to the left of this pixel.
 
Pixelright = nullptr
 Pointer to the pixel to the right of this pixel.
 

Detailed Description

Represents a pixel in a 2D grid with positional, color, and neighbor information.

The Pixel class stores data for a single pixel, including its position, color, and connections to neighboring pixels (up, down, left, right). It provides methods for managing these relationships and accessing pixel properties.

Definition at line 25 of file Pixel.h.

Constructor & Destructor Documentation

◆ Pixel() [1/2]

Pixel ( )

Default constructor.

Constructs a Pixel object with default settings.

Definition at line 3 of file Pixel.cpp.

◆ Pixel() [2/2]

Pixel ( const Vector2D position)

Constructs a Pixel object with a specified position.

Parameters
positionPointer to the pixel's position in 2D space.

Definition at line 7 of file Pixel.cpp.

References position.

Member Function Documentation

◆ GetDownPixel()

Pixel * GetDownPixel ( )

Retrieves the pixel below this pixel.

Returns
Pointer to the pixel below, or nullptr if none exists.

Definition at line 55 of file Pixel.cpp.

References down.

◆ GetLeftPixel()

Pixel * GetLeftPixel ( )

Retrieves the pixel to the left of this pixel.

Returns
Pointer to the pixel to the left, or nullptr if none exists.

Definition at line 59 of file Pixel.cpp.

References left.

◆ GetPosition()

const Vector2D GetPosition ( )

Retrieves the pixel's position.

Returns
A copy of the pixel's position as a Vector2D object.

Definition at line 11 of file Pixel.cpp.

References position.

◆ GetRightPixel()

Pixel * GetRightPixel ( )

Retrieves the pixel to the right of this pixel.

Returns
Pointer to the pixel to the right, or nullptr if none exists.

Definition at line 63 of file Pixel.cpp.

References right.

◆ GetUpPixel()

Pixel * GetUpPixel ( )

Retrieves the pixel above this pixel.

Returns
Pointer to the pixel above, or nullptr if none exists.

Definition at line 51 of file Pixel.cpp.

References up.

◆ HasDownPixel()

bool HasDownPixel ( )

Checks if a pixel exists below this pixel.

Returns
True if a pixel exists below, otherwise false.

Definition at line 39 of file Pixel.cpp.

References downExists.

◆ HasLeftPixel()

bool HasLeftPixel ( )

Checks if a pixel exists to the left of this pixel.

Returns
True if a pixel exists to the left, otherwise false.

Definition at line 43 of file Pixel.cpp.

References leftExists.

◆ HasRightPixel()

bool HasRightPixel ( )

Checks if a pixel exists to the right of this pixel.

Returns
True if a pixel exists to the right, otherwise false.

Definition at line 47 of file Pixel.cpp.

References rightExists.

◆ HasUpPixel()

bool HasUpPixel ( )

Checks if a pixel exists above this pixel.

Returns
True if a pixel exists above, otherwise false.

Definition at line 35 of file Pixel.cpp.

References upExists.

◆ SetDownPixel()

void SetDownPixel ( Pixel pixel)

Sets the pixel below this pixel.

Parameters
pixelPointer to the pixel below this pixel.

Definition at line 20 of file Pixel.cpp.

References down, and downExists.

◆ SetLeftPixel()

void SetLeftPixel ( Pixel pixel)

Sets the pixel to the left of this pixel.

Parameters
pixelPointer to the pixel to the left of this pixel.

Definition at line 25 of file Pixel.cpp.

References left, and leftExists.

◆ SetRightPixel()

void SetRightPixel ( Pixel pixel)

Sets the pixel to the right of this pixel.

Parameters
pixelPointer to the pixel to the right of this pixel.

Definition at line 30 of file Pixel.cpp.

References right, and rightExists.

◆ SetUpPixel()

void SetUpPixel ( Pixel pixel)

Sets the pixel above this pixel.

Parameters
pixelPointer to the pixel above this pixel.

Definition at line 15 of file Pixel.cpp.

References up, and upExists.

Member Data Documentation

◆ Color

Pointer to the RGB color of the pixel.

Definition at line 40 of file Pixel.h.

◆ down

Pixel* down = nullptr
private

Pointer to the pixel below this pixel.

Definition at line 35 of file Pixel.h.

Referenced by GetDownPixel(), and SetDownPixel().

◆ downExists

bool downExists = false
private

Indicates if a pixel exists below this pixel.

Definition at line 30 of file Pixel.h.

Referenced by HasDownPixel(), and SetDownPixel().

◆ left

Pixel* left = nullptr
private

Pointer to the pixel to the left of this pixel.

Definition at line 36 of file Pixel.h.

Referenced by GetLeftPixel(), and SetLeftPixel().

◆ leftExists

bool leftExists = false
private

Indicates if a pixel exists to the left of this pixel.

Definition at line 31 of file Pixel.h.

Referenced by HasLeftPixel(), and SetLeftPixel().

◆ position

const Vector2D* position
private

Pointer to the pixel's position in 2D space.

Definition at line 27 of file Pixel.h.

Referenced by GetPosition(), and Pixel().

◆ right

Pixel* right = nullptr
private

Pointer to the pixel to the right of this pixel.

Definition at line 37 of file Pixel.h.

Referenced by GetRightPixel(), and SetRightPixel().

◆ rightExists

bool rightExists = false
private

Indicates if a pixel exists to the right of this pixel.

Definition at line 32 of file Pixel.h.

Referenced by HasRightPixel(), and SetRightPixel().

◆ sorted

bool sorted = false
private

Indicates whether the pixel has been processed in sorting algorithms.

Definition at line 28 of file Pixel.h.

◆ up

Pixel* up = nullptr
private

Pointer to the pixel above this pixel.

Definition at line 34 of file Pixel.h.

Referenced by GetUpPixel(), and SetUpPixel().

◆ upExists

bool upExists = false
private

Indicates if a pixel exists above this pixel.

Definition at line 29 of file Pixel.h.

Referenced by HasUpPixel(), and SetUpPixel().


The documentation for this class was generated from the following files: