/// <summary> /// Transforms the given points using this transformation matrix. /// </summary> /// public PointH[] TransformPoints(params PointH[] points) { PointH[] r = new PointH[points.Length]; for (int j = 0; j < points.Length; j++) { r[j].X = elements[0] * points[j].X + elements[1] * points[j].Y + elements[2] * points[j].W; r[j].Y = elements[3] * points[j].X + elements[4] * points[j].Y + elements[5] * points[j].W; r[j].W = elements[6] * points[j].X + elements[7] * points[j].Y + points[j].W; } return(r); }
/// <summary> /// Compares two objects for equality. /// </summary> /// public override bool Equals(object obj) { if (obj is PointH) { PointH p = (PointH)obj; if (px / pw == p.px / p.pw && py / pw == p.py / p.pw) { return(true); } } return(false); }
/// <summary> /// Converts to a Integer point by truncating the point coordinates. /// </summary> /// public static Point Truncate(PointH point) { return(new Point( (int)System.Math.Truncate(point.px / point.pw), (int)System.Math.Truncate(point.py / point.pw))); }
/// <summary> /// Converts to a Integer point by rounding the point coordinates. /// </summary> /// public static Point Round(PointH point) { return(new Point( (int)System.Math.Round(point.px / point.pw), (int)System.Math.Round(point.py / point.pw))); }
/// <summary> /// Converts to a Integer point by computing the ceiling of the point coordinates. /// </summary> /// public static Point Ceiling(PointH point) { return(new Point( (int)System.Math.Ceiling(point.px / point.pw), (int)System.Math.Ceiling(point.py / point.pw))); }
/// <summary> /// Add the values of two points. /// </summary> /// public PointH Add(PointH value) { return(this + value); }
/// <summary> /// Subtracts the values of two points. /// </summary> /// public PointH Subtract(PointH value) { return(this - value); }