Click here to Skip to main content
15,897,518 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Updated question( What's wrong in previous location of an object ? ) Pin
jschell19-Jan-12 8:29
jschell19-Jan-12 8:29 
GeneralRe: Updated question( What's wrong in previous location of an object ? ) Pin
Richard MacCutchan19-Jan-12 8:48
mveRichard MacCutchan19-Jan-12 8:48 
GeneralRe: Updated question( What's wrong in previous location of an object ? ) Pin
Albert Holguin19-Jan-12 4:06
professionalAlbert Holguin19-Jan-12 4:06 
GeneralRe: Updated question( What's wrong in previous location of an object ? ) Pin
love bird19-Jan-12 4:12
love bird19-Jan-12 4:12 
GeneralRe: Updated question( What's wrong in previous location of an object ? ) Pin
Richard MacCutchan20-Jan-12 1:59
mveRichard MacCutchan20-Jan-12 1:59 
QuestionWhat's wrong in previous location of an object ? Pin
love bird19-Jan-12 2:09
love bird19-Jan-12 2:09 
QuestionRe: What's wrong in previous location of an object ? Pin
CPallini19-Jan-12 2:16
mveCPallini19-Jan-12 2:16 
AnswerRe: What's wrong in previous location of an object ? Pin
love bird19-Jan-12 2:38
love bird19-Jan-12 2:38 
<pre lang="text">Edited and may be good enough to understand Code :</pre>


<pre lang="text">I want to maintain previous location of blob .
so declare a struct of coordinates some thing like this .</pre>

<pre lang="c++">
struct coordinate
{
unsigned int x;
unsigned int y;
unsigned int prevX;
unsigned int prevY;

void * data;
};</pre>


and blob struct is like


<pre lang="c++">struct blob
{
//unsigned int blobId;
coordinate min, max;
coordinate center;
};
</pre>


<pre lang="text">and i used map to maintain each blob as an id . and its location as value of id/.

I calculated each blob previous location some thing like this </pre>


<pre lang="c++">// Calculate center
for(map<unsigned int, blob>::iterator i = blobs.begin(); i != blobs.end(); ++i)
{

(*i).second.center.x = (*i).second.min.x + ((*i).second.max.x - (*i).second.min.x) / 2;
(*i).second.center.y = (*i).second.min.y + ((*i).second.max.y - (*i).second.min.y) / 2;

(*i).second.center.prevX = (*i).second.center.x;
(*i).second.center.prevY = (*i).second.center.y;

}
</pre>


<pre lang="text">
this image link : http://imageshack.us/photo/my-images/192/mainprevposagaingeachbl.png/</pre>


<pre lang="text">Previous location seems like not correct .
If first time current X = 2 and current Y = 5 then previous X and previous Y should be 0
then if an object take one more step then if an object have current X = 10 and current Y = 44
then previous X should have 2 and previous Y should have 5 .

what's wrong ?
Can some one please help me .thanks</pre>
GeneralRe: What's wrong in previous location of an object ? Pin
CPallini19-Jan-12 2:48
mveCPallini19-Jan-12 2:48 
AnswerRe: What's wrong in previous location of an object ? Pin
CPallini19-Jan-12 2:45
mveCPallini19-Jan-12 2:45 
GeneralRe: What's wrong in previous location of an object ? Pin
David Crow19-Jan-12 3:02
David Crow19-Jan-12 3:02 
GeneralRe: What's wrong in previous location of an object ? Pin
Richard MacCutchan19-Jan-12 3:55
mveRichard MacCutchan19-Jan-12 3:55 
GeneralRe: What's wrong in previous location of an object ? Pin
David Crow19-Jan-12 4:09
David Crow19-Jan-12 4:09 
Questionhow to maintain previous location of an object using maps in c++ ? Pin
love bird19-Jan-12 1:15
love bird19-Jan-12 1:15 
QuestionRe: how to maintain previous location of an object using maps in c++ ? Pin
CPallini19-Jan-12 1:47
mveCPallini19-Jan-12 1:47 
QuestionHow can i store object current and previous location as an id of object ? Pin
love bird18-Jan-12 19:36
love bird18-Jan-12 19:36 
AnswerRe: How can i store object current and previous location as an id of object ? Pin
«_Superman_»18-Jan-12 19:44
professional«_Superman_»18-Jan-12 19:44 
GeneralRe: How can i store object current and previous location as an id of object ? Pin
love bird18-Jan-12 20:54
love bird18-Jan-12 20:54 
GeneralRe: How can i store object current and previous location as an id of object ? Pin
«_Superman_»18-Jan-12 21:05
professional«_Superman_»18-Jan-12 21:05 
GeneralRe: How can i store object current and previous location as an id of object ? Pin
CPallini18-Jan-12 22:17
mveCPallini18-Jan-12 22:17 
AnswerRe: How can i store object current and previous location as an id of object ? Pin
Richard MacCutchan18-Jan-12 21:38
mveRichard MacCutchan18-Jan-12 21:38 
QuestionBuilding for older Windows versions with VS 2010 Pin
John Buller18-Jan-12 4:31
John Buller18-Jan-12 4:31 
AnswerRe: Building for older Windows versions with VS 2010 Pin
Albert Holguin18-Jan-12 4:48
professionalAlbert Holguin18-Jan-12 4:48 
GeneralRe: Building for older Windows versions with VS 2010 Pin
John Buller18-Jan-12 8:58
John Buller18-Jan-12 8:58 
GeneralRe: Building for older Windows versions with VS 2010 Pin
Albert Holguin18-Jan-12 9:55
professionalAlbert Holguin18-Jan-12 9:55 

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.