Detecting points under line

Started by
0 comments, last by idinev 14 years, 4 months ago
Hi, Was wondering how am I able to detect points or edges of an object under a drawn line. Take this example for intance, I load a cube object and I draw a line in front of it, making it look like 2 seperate halves.(how the line is drawn is by using the mouse dragged event and temporary disable the depth test) Now I would like to detect the points/edges under the line that can be seen on screen.How am I able to do that...? Thanks for the help...
Advertisement
The framebuffer contains only pixel-data, no point or edge-data. The zbuffer lets you view/sample the data, that is not occluded. So, either:
- make your own set of maths functions to 3D-geometrically hittest the mouse's ray against points and lines. Requires some sorting and culling code.
or
- make use of the zbuffer. Draw 2px-wide lines as edges, and 2x2 px points as vertices over the already-rasterized scene. Of course, you have to colour-tag every object (line, edge, triangle). You could keep triangles black, if you don't need hittest on them.

This topic is closed to new replies.

Advertisement