Example #1
0
        public void ResetPoints()
        {
            t.ShapeArray = ShapePoints;
            t.BuildBoundingBox();
            SPoint sub = new SPoint(0, t.bounds.Top);

            for (int i = 0; i < ShapePoints.Count(); i++)
            {
                ShapePoints[i] -= sub;
            }
            //ShapePoints.ForEach(delegate(SPoint s) { s -= new SPoint(100,100); });
        }
        public void BuildBoundingBox()
        {
            SPoint minx = new SPoint(9999, 9999), miny = new SPoint(9999, 9999), maxx = new SPoint(0, 0), maxy = new SPoint(0, 0);

            foreach (SPoint p in ShapeArray)
            {
                minx = p.X < minx.X ? p : minx;
                miny = p.Y < miny.Y ? p : miny;
                maxx = p.X > maxx.X ? p : maxx;
                maxy = p.Y > maxy.Y ? p : maxy;
            }
            bounds = new RectangleF(minx.X, miny.Y, maxx.X - minx.X + 1, maxy.Y - miny.Y + 1);
        }
Example #3
0
 public Vector(double m, SPoint d)
 {
     Magnitude = m;
     Direction = d;
 }
Example #4
0
 public Vector(SPoint direction)
 {
     Direction = direction;
     Magnitude = Math.Sqrt(Math.Pow(Direction.X, 2) + Math.Pow(Direction.Y, 2));
 }
Example #5
0
 public Vector(SPoint start, SPoint end)
 {
     Magnitude = Math.Sqrt(Math.Pow(end.X - start.X, 2) + Math.Pow(end.Y - start.Y, 2));
     Direction = start - end;
 }
Example #6
0
 public Vector(Vector a)
 {
     this.Direction = a.Direction;
     this.Magnitude = a.Magnitude;
 }