예제 #1
0
        /// <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);
        }
예제 #2
0
파일: PointH.cs 프로젝트: EnergonV/BestCS
        /// <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);
        }
예제 #3
0
파일: PointH.cs 프로젝트: EnergonV/BestCS
 /// <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)));
 }
예제 #4
0
파일: PointH.cs 프로젝트: EnergonV/BestCS
 /// <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)));
 }
예제 #5
0
파일: PointH.cs 프로젝트: EnergonV/BestCS
 /// <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)));
 }
예제 #6
0
파일: PointH.cs 프로젝트: EnergonV/BestCS
 /// <summary>
 ///   Add the values of two points.
 /// </summary>
 ///
 public PointH Add(PointH value)
 {
     return(this + value);
 }
예제 #7
0
파일: PointH.cs 프로젝트: EnergonV/BestCS
 /// <summary>
 ///   Subtracts the values of two points.
 /// </summary>
 ///
 public PointH Subtract(PointH value)
 {
     return(this - value);
 }