Exemplo n.º 1
0
 //內建初始化 Shape
 public Shape()
 {
     StartPoint = new MyDefPoint();
     EndPoint = new MyDefPoint();
     Width = 0;
     Height = 0;
 }
Exemplo n.º 2
0
 public MyDefPolygon(MyDefPoint[] point,MyDefPoint center)
 {
     CornerPoint = new MyDefPoint[4];
     Center = new MyDefPoint(center.X,Center.Y);
     for (int i = 0; i < 4; i++)
     {
         CornerPoint[i].X = point[i].X;
         CornerPoint[i].Y = point[i].Y;
     }
 }
Exemplo n.º 3
0
 //根據參數初始化 Shape
 public Shape(double x, double y, double width, double height)
 {
     StartPoint = new MyDefPoint();
     EndPoint = new MyDefPoint();
     StartPoint.X = x;
     StartPoint.Y = y;
     _tempStartPoint.X = x;
     _tempStartPoint.Y = y;
     EndPoint.X = x + width;
     EndPoint.Y = y + height;
     Width = width;
     Height = height;
 }
Exemplo n.º 4
0
        public Model()
        {
            PointPer = -1;
            ControlFlag = false;
            Polygons = new MyDefPoint[4];
            PolygonCenter = new MyDefPoint();
            Quadcopter = null;
            QuadcopterCenter = new MyDefPoint();
            QuadcopterTailCenter = new MyDefPoint();
            _droneClient = new DroneClient("192.168.1.1");
            _droneClient.Start();

            ThreadStart start3 = new ThreadStart(PlaneMotion);
            _planeMotionThread = new Thread(start3);
            _planeMotionThread.Start();
        }
Exemplo n.º 5
0
        public void AddPolygons(double x, double y)
        {
            ++PointPer;
            PointPer %= 4;
            Polygons[PointPer] = new MyDefPoint(x, y);

            if (PointPer == 3)
            {
                PolygonCenter.X = (GetPolygonsMinX() + GetPolygonsMaxX()) / 2.0;
                PolygonCenter.Y = (GetPolygonsMinY() + GetPolygonsMaxY()) / 2.0;
            }
        }
Exemplo n.º 6
0
 private double GetTriangleValue(MyDefPoint p1, MyDefPoint p2, MyDefPoint p3)
 {
     MyDefPoint s1 = new MyDefPoint(p1.X - p2.X, p1.Y - p2.Y);
     MyDefPoint s2 = new MyDefPoint(p1.X - p3.X, p1.Y - p3.Y);
     return Math.Abs(0.5 * (s1.X * s2.Y - s1.Y * s2.X));
 }