ProtoBot
Loading...
Searching...
No Matches
SeparationCell Struct Reference

Structure for cell within the spatial grid used for BOIDS separation optimization.
Each cell has an x and y coordinate, as well as an operator+ for adding two SeparationCells together and an operator== for comparing two SeparationCells. More...

#include <BOIDS.h>

Public Member Functions

 SeparationCell (int x, int y)
SeparationCell operator+ (const SeparationCell &other)
bool operator== (const SeparationCell &other) const

Public Attributes

int x
int y

Detailed Description

Structure for cell within the spatial grid used for BOIDS separation optimization.
Each cell has an x and y coordinate, as well as an operator+ for adding two SeparationCells together and an operator== for comparing two SeparationCells.

Definition at line 30 of file BOIDS.h.

Constructor & Destructor Documentation

◆ SeparationCell() [1/2]

SeparationCell::SeparationCell ( )
inline

Definition at line 33 of file BOIDS.h.

33 {
34 this->x = 0;
35 this->y = 0;
36 }

◆ SeparationCell() [2/2]

SeparationCell::SeparationCell ( int x,
int y )
inline

Definition at line 38 of file BOIDS.h.

38 {
39 this->x = x;
40 this->y = y;
41 }

Member Function Documentation

◆ operator+()

SeparationCell SeparationCell::operator+ ( const SeparationCell & other)
inline

Definition at line 43 of file BOIDS.h.

43 {
44 return SeparationCell(this->x + other.x, this->y + other.y);
45 }

◆ operator==()

bool SeparationCell::operator== ( const SeparationCell & other) const
inline

Definition at line 47 of file BOIDS.h.

47 {
48 return x == other.x && y == other.y;
49 }

Member Data Documentation

◆ x

int SeparationCell::x

Definition at line 31 of file BOIDS.h.

◆ y

int SeparationCell::y

Definition at line 31 of file BOIDS.h.


The documentation for this struct was generated from the following file: