public override bool Equals(object obj) { if (obj is SizeR) { SizeR sz = (SizeR)obj; return(Width == sz.Width && Height == sz.Height); } return(false); }
// translates the points by the given delta amounts public static ArrayList TranslateBy(ArrayList points, SizeR sz) { ArrayList newPoints = new ArrayList(points.Count); for (int i = 0; i < points.Count; i++) { PointR p = (PointR)points[i]; p.X += sz.Width; p.Y += sz.Height; newPoints.Add(p); } return(newPoints); }
// scales by the percentages contained in the 'sz' parameter. values of 1.0 would result in the // identity scale (that is, no change). public static ArrayList ScaleBy(ArrayList points, SizeR sz) { ArrayList newPoints = new ArrayList(points.Count); RectangleR r = FindBox(points); for (int i = 0; i < points.Count; i++) { PointR p = (PointR)points[i]; p.X *= sz.Width; p.Y *= sz.Height; newPoints.Add(p); } return(newPoints); }
// scales the points so that they form the size given. does not restore the // origin of the box. public static ArrayList ScaleTo(ArrayList points, SizeR sz) { ArrayList newPoints = new ArrayList(points.Count); RectangleR r = FindBox(points); for (int i = 0; i < points.Count; i++) { PointR p = (PointR)points[i]; if (r.Width != 0d) { p.X *= (sz.Width / r.Width); } if (r.Height != 0d) { p.Y *= (sz.Height / r.Height); } newPoints.Add(p); } return(newPoints); }
// translates the points by the given delta amounts public static ArrayList TranslateBy(ArrayList points, SizeR sz) { ArrayList newPoints = new ArrayList(points.Count); for (int i = 0; i < points.Count; i++) { PointR p = (PointR) points[i]; p.X += sz.Width; p.Y += sz.Height; newPoints.Add(p); } return newPoints; }
// scales the points so that they form the size given. does not restore the // origin of the box. public static ArrayList ScaleTo(ArrayList points, SizeR sz) { ArrayList newPoints = new ArrayList(points.Count); RectangleR r = FindBox(points); for (int i = 0; i < points.Count; i++) { PointR p = (PointR) points[i]; if (r.Width != 0d) p.X *= (sz.Width / r.Width); if (r.Height != 0d) p.Y *= (sz.Height / r.Height); newPoints.Add(p); } return newPoints; }
// scales by the percentages contained in the 'sz' parameter. values of 1.0 would result in the // identity scale (that is, no change). public static ArrayList ScaleBy(ArrayList points, SizeR sz) { ArrayList newPoints = new ArrayList(points.Count); RectangleR r = FindBox(points); for (int i = 0; i < points.Count; i++) { PointR p = (PointR) points[i]; p.X *= sz.Width; p.Y *= sz.Height; newPoints.Add(p); } return newPoints; }
// copy constructor public SizeR(SizeR sz) { _cx = sz.Width; _cy = sz.Height; }