Open
Conversation
Storage/DiskManagment.c
Outdated
| { | ||
| //If the point I want to add already exists | ||
| if (quadTree->quadNode->imagePoints.TL.x == node->imagePoints.TL.x && quadTree->quadNode->imagePoints.TL.y == node->imagePoints.TL.y) { | ||
| removeIfExist(quadTree->quadNode->LinkedList_ptr); |
Collaborator
There was a problem hiding this comment.
enter to this function(remove if exsit) all the logic
Storage/DiskManagment.c
Outdated
| //If the point I want to add already exists | ||
| if (quadTree->quadNode->imagePoints.TL.x == node->imagePoints.TL.x && quadTree->quadNode->imagePoints.TL.y == node->imagePoints.TL.y) { | ||
| removeIfExist(quadTree->quadNode->LinkedList_ptr); | ||
| QuadNode_t* saveToRemove = quadTree->quadNode; |
Collaborator
There was a problem hiding this comment.
allocate all var at the begining
Storage/DiskManagment.c
Outdated
| // Checks whether to enter the TL | ||
| if (existingNode->imagePoints.TL.x <= midX && existingNode->imagePoints.TL.y <= midY) | ||
| { | ||
| if (quadTree->topLeftTree == NULL) |
Storage/DiskManagment.c
Outdated
| { | ||
| if (quadTree->topLeftTree == NULL) | ||
| { | ||
| quadTree->topLeftTree = createQuadTree(quadTree->TL, CreatePoint(midX, midY)); |
Collaborator
There was a problem hiding this comment.
add function that do switch from where
Storage/DiskManagment.c
Outdated
| QuadNode_t* existingNode = quadTree->quadNode; | ||
| quadTree->quadNode = NULL; | ||
| // Checks whether to enter the TL | ||
| if (existingNode->imagePoints.TL.x <= midX && existingNode->imagePoints.TL.y <= midY) |
Collaborator
There was a problem hiding this comment.
add the if to new func for checking from where the point came.
Storage/DiskManagment.c
Outdated
| free(saveToRemove); | ||
| return; | ||
| } | ||
| else |
Storage/DiskManagment.c
Outdated
| if (existingNode->imagePoints.TL.x <= midX && existingNode->imagePoints.TL.y > midY) | ||
| { | ||
| if (quadTree->botLeftTree == NULL) | ||
| { |
Collaborator
There was a problem hiding this comment.
add new func that create quadTree and init all parms used at all the if's
| return; | ||
| } | ||
| //The place I want to enter is taken | ||
| if (quadTree->quadNode != NULL) |
Collaborator
There was a problem hiding this comment.
to export to inline function and the name's func will explain what the if check
Storage/DiskManagment.c
Outdated
| int midX = (quadTree->TL.x + quadTree->BR.x) / 2; | ||
| int midY = (quadTree->TL.y + quadTree->BR.y) / 2; | ||
| //The recursion breakpoint when the node found his correct place and everything is NULL | ||
| if (quadTree->quadNode == NULL && quadTree->topLeftTree == NULL && |
Collaborator
There was a problem hiding this comment.
export to inline function
Storage/DiskManagment.c
Outdated
| free(saveToRemove); | ||
| return; | ||
| } | ||
| else |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.