Canguro.Controller.Snap.SnapController.createPerpendicularMagnet C# (CSharp) Méthode

createPerpendicularMagnet() private méthode

Returns a perpendicular point magnet P if there's a point X and a line L which can be united by a perpendicular line: L | | X - - - - - - - - P | |
private createPerpendicularMagnet ( 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
Résultat PointMagnet
        private PointMagnet createPerpendicularMagnet(LineMagnet lm, GraphicView activeView, System.Windows.Forms.MouseEventArgs e)
        {
            if (lm == null) return null;
            float lmDot = Vector3.Dot(lm.Direction, lm.Direction);

            if (points.PrimaryPoint != null)
            {
                PointMagnet perp = addPerpendicularMagnet(lm, points.PrimaryPoint, lmDot, activeView, e);
                if (perp != null) return perp;
            }
            if (points.LastPoint != null)
                return addPerpendicularMagnet(lm, points.LastPoint, lmDot, activeView, e);

            return null;
        }