Click to See Complete Forum and Search --> : Selection Algorithm


fnovas
May 4th, 1999, 02:52 PM
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

tangzibo
May 5th, 1999, 02:16 AM
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.

fnovas
May 5th, 1999, 10:16 AM
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

tangzibo
May 6th, 1999, 11:12 PM
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.

Deepak Patil
May 7th, 1999, 08:00 AM
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 patdee@hotmail.com.
Thanking you.

Regards,
Deepak Patil

Deepak Patil

qiyang
July 18th, 1999, 01:12 AM
Could give me your sample source?
I am in great need of it.
My E-mail :yqbridge@990.net