How to select an edge

Hello. I have an array of points whose positions I edit using Handles.PositionHandle. I want to add the ability to select edges on the mouse button to generate a point in the middle of it. I can’t figure out how I can make an interactive selection of an edge, do you have any ideas?

I would start with the source code in the ProBuilder package… they have the ability to select edges on a piece of built geometry, when you’re in edge selection mode, and that might give you ideas of what is involved.