GIDForums  

Go Back   GIDForums > Computer Programming Forums > C++ Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 26-May-2004, 05:29
Nelly Nelly is offline
New Member
 
Join Date: Apr 2004
Posts: 15
Nelly is on a distinguished road

displaying array of points


Hello,

I have a struct which consist of 5 varaibles.


CPP / C++ / C Code:
struct Face
{
    //has x and y cordinates
     int mouth; 
     int nose;
    . . . 
    int FrameNo;
 }

This stuct is stored in a vector.

CPP / C++ / C Code:
Face FT;

vector < Face > & Feat

The vector will store several struct and is indexed by FrameNo.

I use an array of point[5], to display the different screen cordinates of those variables, which is declared in myDoc class.

CPP / C++ / C Code:
CPoint mypoint[5];
int poinIndex = 0    //use as index to the points.

On mouse click, the points are drawn on screen and the struct are updated with the respective cordinates, for each frameNo. Then the struct is push in the vector.

CPP / C++ / C Code:
save (std::vector < Face > & Feat)
{
    Feat.push_back(FT);
}


It can happen that not all variable are updated at the same time. so some might not have a value.
Now I want to display those variables which have a value (not Zero) as per FrameNo.


CPP / C++ / C Code:
RetrieveFeatures (std::vector < Face > & Feat)
{
     CMFFADoc* pDoc = GetDocument();

     //Create loop to access elements in the vector
     for(int i = 0; i < Feat.size();i++)
        {
            FT =  Feat[i]; //assigning the value from vector to struct

           if(pDoc->m_CurrentFrame == FaceFeat.FrameNo)
            {
  
         for(pDoc->pointIndex = 0;pDoc->pointIndex <= 5; pDoc->pointIndex++)
{
      //Get the values for the controls and on display image
    if(FT.mouthX != 0 && FT.mouthY != 0)
       {
            pDoc->m_point[0].x = FT.mouthX;
            pDoc->m_point[0].y = FT.mouthY;
        }

     if (FT.noseX != 0 && FT.noseY!= 0)
        {
           pDoc->m_point[1].x = FT.noseX;
            pDoc->m_point[1].y = FT.noseY;
        }

And I want to be able to go back to the frame allocate the missing point (ie, the onee with zero value).
BUT the problem is that system assumes that all 5 points are allocated even those with the zero values.
So I can't update the empty points.

How can I control the display of the array of points so that only the index of the ones with values will be counted and so that I can later update the empty ones.

Can anyone please, please HELP ! ! ! !

Thanks
Last edited by dsmith : 26-May-2004 at 21:50. Reason: Please use [c] & [/c] for syntax highlighting
 
 

Recent GIDBlogMeeting the populace by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Read file and copy to dinamic array Carlo C++ Forum 3 10-May-2004 19:28
shorthest path-another way Pandiani C++ Forum 6 09-May-2004 19:51
Speed up C++ code about 3d array! Truong Son C++ Forum 0 16-Mar-2004 21:52
c: array comparison jack C Programming Language 7 26-Jan-2004 11:21
Extra null element in an array samtediou MySQL / PHP Forum 2 11-Dec-2003 11:52

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 16:04.


vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.