Canguro.Controller.Snap.SnapController.addPerpendicularMagnet C# (CSharp) Method

addPerpendicularMagnet() private method

Method to add a perpendicular point magnet if the mouse is close to where it is
private addPerpendicularMagnet ( LineMagnet lm, PointMagnet pm, float lmDot, GraphicView activeView, System e ) : PointMagnet
lm LineMagnet
pm PointMagnet
lmDot float
activeView GraphicView
e System
return PointMagnet
        private PointMagnet addPerpendicularMagnet(LineMagnet lm, PointMagnet pm, float lmDot, GraphicView activeView, System.Windows.Forms.MouseEventArgs e)
        {
            float r = Vector3.Dot(lm.Direction, pm.Position - lm.Position) / lmDot;
            PointMagnet perpPtMagnet = new PointMagnet(lm.Position + Vector3.Scale(lm.Direction, r),
                PointMagnetType.Perpendicular);
            if (perpPtMagnet.Snap(activeView, e.Location) < SnapViewDistance)
            {
                perpPtMagnet.RelatedMagnets.Add(pm);
                perpPtMagnet.RelatedMagnets.Add(lm);
                points.Add(perpPtMagnet);
                return perpPtMagnet;
            }

            return null;
        }