ProtoTracer  1.0
Real-time 3D rendering and animation engine
Loading...
Searching...
No Matches
Pixel.cpp
Go to the documentation of this file.
1#include "Pixel.h"
2
4 // Default constructor
5}
6
7Pixel::Pixel(const Vector2D* position) {
8 this->position = position;
9}
10
12 return *position;
13}
14
16 this->up = pixel;
17 this->upExists = true;
18}
19
21 this->down = pixel;
22 this->downExists = true;
23}
24
26 this->left = pixel;
27 this->leftExists = true;
28}
29
31 this->right = pixel;
32 this->rightExists = true;
33}
34
36 return upExists;
37}
38
40 return downExists;
41}
42
44 return leftExists;
45}
46
48 return rightExists;
49}
50
52 return up;
53}
54
56 return down;
57}
58
60 return left;
61}
62
64 return right;
65}
Declares the Pixel class for managing pixel data and relationships in a 2D grid.
Represents a pixel in a 2D grid with positional, color, and neighbor information.
Definition Pixel.h:25
void SetRightPixel(Pixel *pixel)
Sets the pixel to the right of this pixel.
Definition Pixel.cpp:30
bool HasRightPixel()
Checks if a pixel exists to the right of this pixel.
Definition Pixel.cpp:47
bool upExists
Indicates if a pixel exists above this pixel.
Definition Pixel.h:29
Pixel * GetLeftPixel()
Retrieves the pixel to the left of this pixel.
Definition Pixel.cpp:59
bool HasLeftPixel()
Checks if a pixel exists to the left of this pixel.
Definition Pixel.cpp:43
Pixel()
Default constructor.
Definition Pixel.cpp:3
Pixel * up
Pointer to the pixel above this pixel.
Definition Pixel.h:34
Pixel * left
Pointer to the pixel to the left of this pixel.
Definition Pixel.h:36
Pixel * down
Pointer to the pixel below this pixel.
Definition Pixel.h:35
bool rightExists
Indicates if a pixel exists to the right of this pixel.
Definition Pixel.h:32
void SetDownPixel(Pixel *pixel)
Sets the pixel below this pixel.
Definition Pixel.cpp:20
void SetUpPixel(Pixel *pixel)
Sets the pixel above this pixel.
Definition Pixel.cpp:15
bool downExists
Indicates if a pixel exists below this pixel.
Definition Pixel.h:30
Pixel * right
Pointer to the pixel to the right of this pixel.
Definition Pixel.h:37
const Vector2D GetPosition()
Retrieves the pixel's position.
Definition Pixel.cpp:11
bool HasUpPixel()
Checks if a pixel exists above this pixel.
Definition Pixel.cpp:35
const Vector2D * position
Pointer to the pixel's position in 2D space.
Definition Pixel.h:27
bool leftExists
Indicates if a pixel exists to the left of this pixel.
Definition Pixel.h:31
bool HasDownPixel()
Checks if a pixel exists below this pixel.
Definition Pixel.cpp:39
Pixel * GetRightPixel()
Retrieves the pixel to the right of this pixel.
Definition Pixel.cpp:63
Pixel * GetUpPixel()
Retrieves the pixel above this pixel.
Definition Pixel.cpp:51
Pixel * GetDownPixel()
Retrieves the pixel below this pixel.
Definition Pixel.cpp:55
void SetLeftPixel(Pixel *pixel)
Sets the pixel to the left of this pixel.
Definition Pixel.cpp:25
Represents a 2D vector (X, Y) and provides methods for vector arithmetic.
Definition Vector2D.h:27