Selecting Edges of triagles

Blitz3D Forums/Blitz3D Programming/Selecting Edges of triagles

Craig H. Nisbet(Posted 2007) [#1]
Can anyone think of the best way to camera pick an edge of a triangle on the surface of a mesh. I know there is no such thing as an edge as far as the Blitz engine is concerned, but I'd like to be able to retreive the two point on the mesh that would make up that edge. I'd like it to get the points for the edge that is closest to where the mouse was clicked on the model. I'm not sure of math to accomplish this.

The only thing I can think of is to Camera pic the mouse x and y, then get the picktriagle, then from there try to figure out which set of 2 points(the edges) are closet to the picked coords for the mouse. Manipulating those two point would in turn act as if I'm manipulating the edge as apposed to just 1 point.

The problem I'm running into is that I can't figure out the math that would return the edge (2 points) that are closer to where I picked with the mouse.

I hope that makes sense. Any ideas?

here's a ref image of what I'm talking about



DJWoodgate(Posted 2007) [#2]
Maybe something like this would help.
http://www.blitzbasic.com/codearcs/codearcs.php?code=1870
Not tried that routine myself but any 3d point distance to line routine with appropriate parameterisation should do. (there is more than one way to define a line, and you want to use a routine that expects a start xyz and an end xyz). Given the tformed picked coords of a point and a picked triangle select the pair of verts (0>1,1>2,2>0) based on the distance of the point from the edges they define.


Craig H. Nisbet(Posted 2007) [#3]
Yep that was it. That worked great. Thanks!!