CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    May 1999
    Posts
    9

    Selection Algorithm

    Hi Everyone:

    I have a (GUI) for which I need an algorithm to select the graphical
    elements. They are going to be lines in this case. I tried to go
    through the whole list but is very time consumming and not as
    efficient. I would like to be able to update the element's state when
    the mouse moves over it (e.g. color change). BTW I am not really a
    graphics programmer and I am basically using MFC (Win32 API) to do all
    the graphics calls. If someone could point me in the right direction I
    would really appreciate it. This is for a thesis dissertation. I am
    doing physical modelling of a building using a wire frame model.

    Thanks in advance for your help;


    Francisco J. Novas
    P.S. Remove .SPAM from return e-mail address




  2. #2
    Join Date
    Apr 1999
    Posts
    37

    Re: Selection Algorithm

    I think there is no ready graphic calls in MFC(Win32 API) meet your request.

    Following suggests may improve the effect:
    1. If the wire frame model is 3D, you'd better put the projective 2D lines to a memory list, then use these lines to be the pick object.
    2. Before calculating the point distance to line, use box select first. If the point is not in the box, you need not calculate the distance.


  3. #3
    Join Date
    May 1999
    Posts
    9

    Re: Selection Algorithm

    Hi tangzibo:

    Thanks for your reply. Maybe I did not explain myself very well. I know that there is no specific MFC or GDI call that does what I want to do. Like you said I already have the line elements stored in memory. Your CRect algorithm is not bad, my question is, is it fast. Remember that I will have to traverse the complete list to find the element that I am looking for. (BTW) My model is 2D, I do not have to deal with 3D. What i am also looking for is something like the following: when the cursor goes over specific elements in a HTML document or even graphics programs the cursor will change shapes and even the element that is underneath will change state depending on what you want to do with it. This last statement presuposes that the program already knows pretty quick what the element is underneath the cursor. A lot of graphic programs do this including web pages do this. I hope this clarifies my question.

    Thanks again for your help;

    Francisco J. Novas


  4. #4
    Join Date
    Apr 1999
    Posts
    37

    Re: Selection Algorithm

    Hi
    If you use box select first, I think it will fast enough. I write a test application to select line from 10 thousands lines. If you want this application, please tell me your email address.


  5. #5
    Join Date
    May 1999
    Posts
    6

    Re: Selection Algorithm

    Dear ,

    I am also in need of same type of algorithm mentioned by you. if possible please send details or source code of the same application to me.
    My email address is [email protected].
    Thanking you.

    Regards,
    Deepak Patil

    Deepak Patil

  6. #6
    Join Date
    Jun 1999
    Posts
    14

    Re: Selection Algorithm

    Could give me your sample source?
    I am in great need of it.
    My E-mail :[email protected]


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured