bool DistanceBtw(Point p, Pivot joint) { bool ret = false; double x = p.X - joint.x; double y = p.Y - joint.y; x *= x; y *= y; if (Math.Sqrt(x + y) <= 2 * joint.r) { ret = true; } return(ret); }
protected override void OnMouseDown(MouseEventArgs e) { moving = true; if (DistanceBtwO(e.Location, piv)) { selPo = piv; } for (int i = 0; i < pivots.Count; i++) { if (DistanceBtw(e.Location, pivots[i])) { selP = pivots[i]; } } }
protected override void OnMouseUp(MouseEventArgs e) { moving = false; selP = null; selPo = null; }