protected void Draw4Arrows(Graphics g, NPoint p, float length) { /* ^ * <-|-> * v */ DrawArrow(g, p, p.Clone().Add(0, -length), Brushes.YellowGreen, Pens.Red, length); DrawArrow(g, p, p.Clone().Add(0, length), Brushes.YellowGreen, Pens.Red, length); DrawArrow(g, p, p.Clone().Add(-length, 0), Brushes.YellowGreen, Pens.Red, length); DrawArrow(g, p, p.Clone().Add(length, 0), Brushes.YellowGreen, Pens.Red, length); }
protected void DrawVertex(Graphics graphics, NPoint point) { if (point != null) { NPoint s = point.Clone().Add(-NConfig.BLOCK_SIZE, -NConfig.BLOCK_SIZE); graphics.FillRectangle(Brushes.CornflowerBlue, s.X, s.Y, NConfig.BLOCK_SIZE_2, NConfig.BLOCK_SIZE_2); graphics.DrawRectangle(Pens.Red, s.X, s.Y, NConfig.BLOCK_SIZE_2, NConfig.BLOCK_SIZE_2); } }
internal static double Distance(NPoint startPoint, NPoint endPoint) { NPoint p = endPoint.Clone().Subtract(startPoint); return(Math.Sqrt(p.Y * p.Y + p.X * p.X)); }