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

createInterestingDistance() private method

Gets an interesting point by following the line in reverse (as a mirror) and trying to find Joints at the same distance from the LineMagnet's position
private createInterestingDistance ( LineMagnet lm, GraphicView activeView, System e ) : PointMagnet
lm LineMagnet The Line Magnet being followed
activeView GraphicView The view in which the snap is taking place
e System The MouseEventArgs of the last MouseMove event
return PointMagnet
        private PointMagnet createInterestingDistance(LineMagnet lm, GraphicView activeView, System.Windows.Forms.MouseEventArgs e)
        {
            if (lm == null) return null;

            Vector3 pos = lm.Position;
            activeView.Project(ref pos);
            Vector3 reversePickPos = pos + pos - new Vector3(e.X, e.Y, 0f);

            List<Item> pickedItems = Canguro.View.GraphicViewManager.Instance.PickItem((int)reversePickPos.X, (int)reversePickPos.Y);
            if (pickedItems == null) return null;

            foreach (Item item in pickedItems)
            {
                Joint j;
                // Check if Joint si over line lm
                if ((j = item as Joint) != null)
                {
                    Vector3 ptInLine = Vector3.Cross(lm.Direction, j.Position - lm.Position);
                    if (Vector3.Dot(ptInLine, ptInLine) < float.Epsilon)
                    {
                        PointMagnet distMagnet = new PointMagnet(lm.Position + lm.Position - j.Position, PointMagnetType.SimplePoint);
                        distMagnet.RelatedMagnets.Add(new PointMagnet(j));
                        points.Add(distMagnet);
                        return distMagnet;
                    }
                }
            }

            return null;
        }