Hi,
I wasnt sure where to post this topic as its not a questions about game development but Im thinking the same logic could be applied.
I have a CAD program and I need a system where I can select lines/points individually by clicking on them. I developed a system for points where it would iterate through every point and calculate the distance between the point and the mouse cursor, it would then pick the closest point (as long as it wasn’t more then a maximum distance away) as the selected point. this system does seem to work but doesnt seem very efficient especially when you could be talking about thousands of points in a model.
For lines I have no idea how to work that out. One thing to remember is that I dont want the user to have to click on the exact coordinate of the point because this may be difficult and prove frustrating for the user.
Does anyone have an idea of an efficient system that could be applied to this problem? Im sure this must be a fundimental problem in many games.
Thanks,
Ken
(yesterday it was the joy of using enums)