/// <summary> /// Paint the movement vector /// </summary> internal static IList <UIElement> PaintMovementVector(UIElementCollection children, Point gridPointLast, Point gridPointClicked) { IList <UIElement> uiElementsMovVector = new List <UIElement>(); // Draw the main line Point pointLast = GridBackgroundHelper.ConvertGridPoint2Point(gridPointLast); Point pointClicked = GridBackgroundHelper.ConvertGridPoint2Point(gridPointClicked); uiElementsMovVector.Add(AddLine(children, pointLast, pointClicked)); // make the line an arrow - angle1 Point p1 = VectorMath.CalculateLineEndpointSatisfyingAngle(pointLast, pointClicked, lengthOfArrowLines, angle1); uiElementsMovVector.Add(AddLine(children, pointClicked, p1)); // make the line an arrow - angle2 Point p2 = VectorMath.CalculateLineEndpointSatisfyingAngle(pointLast, pointClicked, lengthOfArrowLines, angle2); uiElementsMovVector.Add(AddLine(children, pointClicked, p2)); return(uiElementsMovVector); }
public bool ValidateVector(IList <Point> routeGridPoints, Point gridPointClicked) { bool?baseValidationResult; BaseValidateVector(routeGridPoints, gridPointClicked, out baseValidationResult); if (baseValidationResult.HasValue) { // we are done, base class already made the decision return(baseValidationResult.Value); } // further checks Point point = GridBackgroundHelper.ConvertGridPoint2Point(gridPointClicked); bool innerEllipseIncluded = Contains(innerEllipse, point); if (innerEllipseIncluded) { // point is in the inner ellipse so it is NOT on the track return(false); } // if it is NOT in the inner ellipse then simply check if it is included in the outer ellipse return(Contains(outerEllipse, point)); }