Blame mono/Assistance/GuidelineLine.cs

cfceb0
using System;
cfceb0
using System.Drawing;
cfceb0
using System.Drawing.Imaging;
cfceb0
using System.Collections.Generic;
cfceb0
cfceb0
namespace Assistance {
cfceb0
	public class GuidelineLine: Guideline {
cfceb0
		protected Point p0, p1;
cfceb0
		protected Point direction;
cfceb0
		
cfceb0
		public GuidelineLine(Point p0, Point p1) {
cfceb0
			this.p0 = p0;
cfceb0
			this.p1 = p1;
cfceb0
			direction = (p1 - p0).normalize();
cfceb0
		}
cfceb0
		
cfceb0
		public override void draw(Graphics g, bool active) {
cfceb0
			Point pp0 = p0;
cfceb0
			Point pp1 = p1;
cfceb0
			Geometry.truncateInfiniteLine(new Rectangle(g.VisibleClipBounds), ref pp0, ref pp1);
cfceb0
			g.DrawLine(active ? penActive : pen , pp0.toFloat(), pp1.toFloat());
cfceb0
		}
cfceb0
		
cfceb0
		public override Point transformPoint(Point p) {
cfceb0
			return Point.dot(p - p0, direction)*direction + p0;
cfceb0
		}
cfceb0
	}
cfceb0
}
cfceb0