Skip to content

Commit

Permalink
Major Change-> Each box will be just a point, no more a square with 4…
Browse files Browse the repository at this point in the history
… corners, last commit before i change the initialising values of all ..._abs, ..._min, ..._max in constructor

Changes -> will use signed coordinates everywhere now
  • Loading branch information
adi-g15 committed Oct 19, 2020
1 parent 1854f80 commit 7f8a541
Show file tree
Hide file tree
Showing 7 changed files with 140 additions and 118 deletions.
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@
"streambuf": "cpp",
"thread": "cpp",
"cinttypes": "cpp",
"typeinfo": "cpp"
"typeinfo": "cpp",
"xtree": "cpp"
},
"workbench.colorCustomizations": {
"activityBar.background": "#13332D",
Expand Down
10 changes: 5 additions & 5 deletions graphMat/graph__square_mat_decl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@

#include "graph_mat_decl.hpp"

template< typename node_type, typename udimen_t = uint32_t >
class Square_Matrix: public Graph_Matrix<node_type, udimen_t>{
template< typename node_type, typename dimen_t = int32_t >
class Square_Matrix: public Graph_Matrix<node_type, dimen_t>{
public:
udimen_t getOrder() const{ //order of the matrix
return this->_N_Rows;
dimen_t getOrder() const{ //order of the matrix
return this->_total_y_abs;
}
void resize(udimen_t new_order) override{
void resize(dimen_t new_order) override{
this->resize(new_order, new_order);
}

Expand Down
9 changes: 5 additions & 4 deletions graphMat/graph_box.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ typedef std::vector<std::pair< Direction, uint16_t >> graph_position;
template< typename node_type >
struct Graph_Box //make it non-copyable
{
typedef uint32_t udimen_t;
typedef int32_t dimen_t;

public:
const std::remove_reference_t<node_type>& getData() const{ return this->data; }
Expand All @@ -31,9 +31,10 @@ struct Graph_Box //make it non-copyable
}
}

Graph_Box(udimen_t x, udimen_t y): Graph_Box(node_type{}, x, y){}
Graph_Box(dimen_t x, dimen_t y): Graph_Box(node_type{}, x, y){}
Graph_Box(const _coord<dimen_t>& coord): Graph_Box(node_type{}, coord.mX, coord.mY){}

Graph_Box(node_type data, udimen_t x, udimen_t y): data(data), coords(x,y){
Graph_Box(node_type data, dimen_t x, dimen_t y): data(data), coords(x,y){
this->up = nullptr;
this->down = nullptr;
this->left = nullptr;
Expand All @@ -52,7 +53,7 @@ struct Graph_Box //make it non-copyable
protected:
node_type data; /*This has been given as an extension, so that you can add more variables to the graph_box
though, note that, you will be able to access using this->data->your_var_name */
_coord<udimen_t> coords; // @NOTE - not actually needed, though this maybe used in my implementation of snake
_coord<dimen_t> coords; // @NOTE - not actually needed, though this maybe used in my implementation of snake

Graph_Box* right;
Graph_Box* left;
Expand Down
Loading

0 comments on commit 7f8a541

Please sign in to comment.