Click here to Skip to main content
15,887,923 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
C++
CRect rc;
rc.UnionRect(m_DMBR,childNode->GetDMBR());


M_DMBR is empty,and childNode->GetDMBR()has values;
I want to know why rc is empty?
and I make a little test like this:

C++
CRect rt =CRect(35,35,112,112);
CRect rc,rc1;
rc1.UnionRect(rc,rt);


rc1 is not empty.

I dont know the reason.somebody can help me?
Posted
Updated 25-Sep-12 3:46am
v2
Comments
Malli_S 25-Sep-12 9:49am    
There is a chance that the union is empty. What does the UnionRect() function call returns?
mengfei358 25-Sep-12 10:04am    
CRect rt =CRect(35,35,112,112);
CRect rc,rc1;
rc1.UnionRect(rc,rt);
In this code ,after using UnionRect,rc1 is not empty.
Richard MacCutchan 25-Sep-12 12:40pm    
What is the content of rc at this point? I suspect it has some garbage in it, which is why you get a union that is not zero. You can test this by initialising it to a null rectangle.
Sergey Alexandrovich Kryukov 25-Sep-12 13:31pm    
Maybe, still strange... union is not intersection...
Anyway, OP needs to make a sample where both operands are defined.
--SA
Richard MacCutchan 25-Sep-12 13:39pm    
Exactly so, I'm just guessing here as there is not enough information to be sure.

1 solution

Please check m_DMBR initializing proper?
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900