public bool Contains(Point2i pt) { if (pt.X < XMin || pt.Y < YMin || pt.X > XMax || pt.Y > YMax) { return(false); } return(true); }
/// <summary> /// Measures 'how much' a point (pointx,pointy) is to the left or right of the line from p0 to p1. /// Negative return value => point is right of line /// Posetive return value => point is left of line /// Zero return value => point is on line /// </summary> public static int SideMeasure(Point2i p0, Point2i p1, int pointx, int pointy) { return((p0.X - p1.X) * (p0.Y - pointy) - (p0.Y - p1.Y) * (p0.X - pointx)); }
/// <summary> /// Measures 'how much' this point is to the left or right of the line from p0 to p1. /// Negative return value => point is right of line /// Posetive return value => point is left of line /// Zero return value => point is on line /// </summary> public int SideMeasure(Point2i p0, Point2i p1) { return(SideMeasure(p0, p1, X, Y)); }