PDA

View Full Version : How to do Snap to object?



HanWu
05-12-2003, 12:28 AM
i am doing a CAD program and i would like to add a Snap to object function like autocad do. I try to use autocad even a big model(which consist of many 3D points) it can perform a "snap to" very fast. My algorithm is to search every 3D point in my list( which i use to store objects) and compare to the mouse positions, when the number of object is big, the mouse pointer looks delay when moving.
i have another idea to perform a "snap to" which is select the object that at the top most means that the object which overlapped by other objects are ignored but the problem is i don't know which objects is at the top and which is at behind.
one more question what is color picking. Can anyone tell me or give me the web page to get the tutorial thanks.

Gavin
05-14-2003, 12:03 AM
You could do some sort of recursive subdivision, so at the top level points are grouped into the two halves of the screen, lower down the tree the points are grouped to smaller parts. Even at the top level this can reduce your search