Click here to Skip to main content
15,887,267 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: GCC Linker and Where To Define Structures Pin
CPallini22-Mar-10 21:55
mveCPallini22-Mar-10 21:55 
GeneralRe: GCC Linker and Where To Define Structures Pin
Trevor Johansen24-Mar-10 9:22
Trevor Johansen24-Mar-10 9:22 
GeneralRe: GCC Linker and Where To Define Structures Pin
CPallini24-Mar-10 11:33
mveCPallini24-Mar-10 11:33 
GeneralRe: GCC Linker and Where To Define Structures Pin
Trevor Johansen25-Mar-10 13:08
Trevor Johansen25-Mar-10 13:08 
GeneralRe: GCC Linker and Where To Define Structures Pin
CPallini25-Mar-10 21:41
mveCPallini25-Mar-10 21:41 
QuestionHow do you display a bitmap in IE and control navigation? Pin
nstein222-Mar-10 11:57
nstein222-Mar-10 11:57 
AnswerRe: How do you display a bitmap in IE and control navigation? Pin
KarstenK23-Mar-10 4:21
mveKarstenK23-Mar-10 4:21 
QuestionDeleting a single point from a quadtree Pin
Chidori-chan22-Mar-10 9:43
Chidori-chan22-Mar-10 9:43 
Hi-

I have been trying to work out how to delete a single point from a quad tree and am having no luck at all. Below are the code snippets for delete the entire tree then my failed attempt at deleting a single point. If someone could explain what I am doing wrong I would appreciate it.

Deleting the entire tree:
qnode *
deleteTree (qnode * root)
{
  int i = 0;			//not initalizing to 0 will create segmentation faults.
  for (i = 0; i < 4; i++)	//four loop must be here otherwise it will quit at the first quadrant if there is no point stored there.
    {
      if (root == NULL)

	return root;		// Sub-tree is empty

      /* Delete tree */
      if (root->children[i] != NULL)
	{
	  free (root->children[i]);
	  deleteTree (root->children[i]);
	  if (root->leaf == TRUE)
	    {
	      free (root);
	      root->leaf = NULL;
	    }
	  root->children[i] = NULL;
	  root->leaf;
	  root->cx = NULL;	//returning cx, cy, and size to NULL so the blue cross will not be drawn
	  root->cy = NULL;
	  root->size = NULL;

	}
    }
}


Failed attempt to delete a single point:

qnode *
deleteP (qnode * root, int vx, int vy)
{
  int i = 0;

  if (root->px - 5 >= vx && vx <= root->px + 5 && root->py - 5 >= vy && vy <= root->py + 5)	// gives a distance of five lee-way for the user to click on the point so they do not have to click exact
    {
      if (root == NULL)

	return root;		// Sub-tree is empty

      if (root->leaf == TRUE)
	{

	  root->leaf = NULL;
	  free (root);
	}
      else
	{
	  root->leaf = TRUE;
	  deleteP (root, vx, vy);
	  root->px = NULL;
	  root->py = NULL;
	  free (root);
	}
    }
}


Thank you for your time
AnswerRe: Deleting a single point from a quadtree Pin
Avi Berger22-Mar-10 11:00
Avi Berger22-Mar-10 11:00 
AnswerRe: Deleting a single point from a quadtree Pin
Richard MacCutchan22-Mar-10 11:07
mveRichard MacCutchan22-Mar-10 11:07 
QuestionRe: Deleting a single point from a quadtree Pin
Chidori-chan23-Mar-10 8:52
Chidori-chan23-Mar-10 8:52 
QuestionRST Template Matching Pin
cherrymotion22-Mar-10 6:20
cherrymotion22-Mar-10 6:20 
AnswerRe: RST Template Matching Pin
Tim Craig22-Mar-10 9:45
Tim Craig22-Mar-10 9:45 
GeneralRe: RST Template Matching Pin
cherrymotion22-Mar-10 11:05
cherrymotion22-Mar-10 11:05 
GeneralRe: RST Template Matching Pin
Tim Craig22-Mar-10 13:48
Tim Craig22-Mar-10 13:48 
GeneralRe: RST Template Matching Pin
cherrymotion23-Mar-10 11:18
cherrymotion23-Mar-10 11:18 
GeneralRe: RST Template Matching Pin
Tim Craig23-Mar-10 12:53
Tim Craig23-Mar-10 12:53 
GeneralRe: RST Template Matching Pin
cherrymotion25-Mar-10 6:46
cherrymotion25-Mar-10 6:46 
QuestionModeless dialog frame sizing in MFC MDI Pin
Vaclav_22-Mar-10 3:38
Vaclav_22-Mar-10 3:38 
AnswerRe: Modeless dialog frame sizing in MFC MDI Pin
KarstenK22-Mar-10 5:00
mveKarstenK22-Mar-10 5:00 
GeneralRe: Modeless dialog frame sizing in MFC MDI Pin
Vaclav_22-Mar-10 6:02
Vaclav_22-Mar-10 6:02 
Questionlarger toolbar images Pin
josip cagalj22-Mar-10 1:12
josip cagalj22-Mar-10 1:12 
AnswerRe: larger toolbar images Pin
mesajflaviu22-Mar-10 8:55
mesajflaviu22-Mar-10 8:55 
GeneralRe: larger toolbar images Pin
josip cagalj22-Mar-10 23:27
josip cagalj22-Mar-10 23:27 
AnswerRe: larger toolbar images Pin
josip cagalj24-Mar-10 3:05
josip cagalj24-Mar-10 3:05 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.