Esempio n. 1
0
        public void move(double dx, double dy)
        {
            int n = countPoint();

            for (int i = 0; i < n; i++)
            {
                PointCoord p = (PointCoord)this.polygon[i];
                p.x += dx; p.y += dy;
            }
        }
Esempio n. 2
0
File: Mirror.cs Progetto: q2git/VS
 public PointCoord pointMirrorSymmetry(PointCoord p)
 {
     if (this.isVertical())
     {
         return(new PointCoord(2 * a - p.x, p.y));
     }
     else
     {
         double x2 = (2 * (p.y - b) + (1 / k - k) * p.x) / (k + 1 / k);
         double y2 = p.y + (p.x - x2) / k;
         return(new PointCoord(x2, y2));
     }
 }
Esempio n. 3
0
 public Polygon toScrPolygon(int x0, int y0)
 {
     if (type == TYPE_POLYGON)
     {
         int   n = countPoint();
         int[] x = new int[n], y = new int[n];
         for (int i = 0; i < n; i++)
         {
             Point p = PointCoord.toScrPoint(getPoint(i).x, getPoint(i).y, x0, y0);
             x[i] = p.X; y[i] = p.Y;
         }
         return(new Polygon(x, y, n));
     }
     else
     {
         return(null);                 //?????
     }
 }
Esempio n. 4
0
File: Mirror.cs Progetto: q2git/VS
        public PicObject picObjectMirrorSymmetry(PicObject pic)
        {
            if (pic.mirror == this)
            {
                return(null);                                 // a Pic In this mirror can not through the mirror itself
            }
            Color     color = colorMirrorRef(pic.color, refl);
            PicObject pic2  = new PicObject(pic.type, color, pic.filled);
            int       n     = pic.countPoint();

            for (int i = 0; i < n; i++)
            {
                PointCoord p = pic.getPoint(i);
                pic2.addPoint(pointMirrorSymmetry(p));
            }
            pic2.mirror            = this;
            pic2.originalPicObject = pic.originalPicObject;
            pic2.srcPicObject      = pic;
            return(pic2);
        }
Esempio n. 5
0
 public bool contains(PointCoord p)
 {
     return(toScrPolygon(0, 0).contains(p.toScrPoint(0, 0)));
 }
Esempio n. 6
0
 public void addPoint(PointCoord p)
 {
     addPoint(p.x, p.y);
 }