コード例 #1
0
    /// <summary>
    /// 随机获取指定范围内两个不重复的点
    /// </summary>
    /// <param name="n">范围</param>
    /// <returns>两个点</returns>
    public static _Point[] getRandomStartAndEndPoint(int n, int requestNum, bool fixedStart = true)
    {
        if (requestNum == 0)
        {
            return(new _Point[0]);
        }
        int[] ints = getRandomInts(n);

        _Point[] ps = new _Point[requestNum];
        for (int i = 0; i < requestNum; i++)
        {
            ps[i] = new _Point(0, 0);
        }

        for (int i = 0; i < requestNum; i++)
        {
            ps[i].x = ints[i];
        }

        ints = getRandomInts(n);

        for (int i = 0; i < requestNum; i++)
        {
            ps[i].y = ints[i];
        }

        if (fixedStart)
        {
            ps[0].x = 0;
            ps[0].y = 0;
        }

        return(ps);
    }
コード例 #2
0
ファイル: Animation.cs プロジェクト: thehall45/GGNet
 public _Animation()
 {
     Point = new _Point();
     Bar   = new _Bar();
     Map   = new _Map();
     Hex   = new _Hex();
 }
コード例 #3
0
ファイル: Form1.cs プロジェクト: JaredHam777/3dpixels
    public void ToCube(_Point position, double l)
    {
        this.Position = new _Point(0, 0, l / 2);
        if (Planes != null)
        {
            Planes.Clear();
        }
        else
        {
            Planes = new List <Plane>();
        }

        for (int i = 0; i < 6; i++)
        {
            Planes.Add(new Plane(new List <_Point> {
                new _Point(0, 0, 0), new _Point(0, l, 0), new _Point(l, l, 0), new _Point(l, 0, 0)
            }));
        }
        Planes[0].SetPosition(new _Point(0, 0, 0));
        //Planes[0].Rotate(Axes.Y, 180);
        Planes[1].SetPosition(new _Point(0, l / 2, l / 2));

        Planes[1].Rotate(Axes.X, 90);
        Planes[2].SetPosition(new _Point(0, 0, l));
        Planes[2].Rotate(Axes.Y, 180);
        Planes[3].SetPosition(new _Point(0, -l / 2, l / 2));
        Planes[3].Rotate(Axes.X, 270);
        Planes[4].SetPosition(new _Point(-l / 2, 0, l / 2));
        Planes[4].Rotate(Axes.Y, 90);
        Planes[5].SetPosition(new _Point(l / 2, 0, l / 2));
        Planes[5].Rotate(Axes.Y, 270);

        this.SetPosition(position);
    }
コード例 #4
0
ファイル: Form1.cs プロジェクト: JaredHam777/3dpixels
    public _Point ForceOn(Particle particle, Particle p)
    {
        _Point vector   = VectMath.Subtract(p.Position, particle.Position);    //Vector pointing from particle to p
        double distance = VectMath.Magnitude(vector);

        if (distance > ParticleRadius & distance < AttractionRadius)
        {
            return(VectMath.Scale(vector, (1 / distance)));
        }
        else
        {
            if (distance < ParticleRadius)
            {
                if (distance == 0)
                {
                    return(new _Point(0, 0, 0));
                }
                else
                {
                    return(VectMath.Scale(vector, (-1 / distance)));
                }
            }
            else
            {
                return(new _Point(0, 0, 0));
            }
        }
    }
コード例 #5
0
ファイル: Form1.cs プロジェクト: JaredHam777/3dpixels
        private void button3_Click(object sender, EventArgs e)
        {
            _Point p = new _Point(Convert.ToDouble(textBox1.Text), Convert.ToDouble(textBox2.Text), Convert.ToDouble(textBox3.Text));
            _Point v = new _Point(Convert.ToDouble(textBox4.Text), Convert.ToDouble(textBox5.Text), Convert.ToDouble(textBox6.Text));

            label4.Text = VectMath.RotateByAngle(p, v, Convert.ToDouble(textBox7.Text)).x.ToString() + ", " + VectMath.RotateByAngle(p, v, Convert.ToDouble(textBox7.Text)).y.ToString() + ", " + VectMath.RotateByAngle(p, v, Convert.ToDouble(textBox7.Text)).z.ToString();
        }
コード例 #6
0
    bool getRoad(_Point start, _Point end, List <_Point> roads, int len)
    {
        if (start.x < 0 || start.y < 0 || end.x < 0 || end.y < 0 ||
            start.x >= N || start.y >= N || end.x >= N || end.y >= N ||
            (!start.Equals(end) && len == 0))
        {
            //越界情况
            return(false);
        }
        else if (len == 0 && start.Equals(end))
        {
            //   roads.Add(start);
            return(true);
        }
        else
        {
            Util.Direction d;
            do
            {
                //生成方向
                d = start.getNextDirection();

                //生成新的起点然后继续回调生成路径

                _Point newP = null;
                switch (d)
                {
                case Util.Direction.down:
                    newP = new _Point(start.x + 1, start.y, d);
                    break;

                case Util.Direction.up:
                    newP = new _Point(start.x - 1, start.y, d);
                    break;

                case Util.Direction.right:
                    newP = new _Point(start.x, start.y + 1, d);
                    break;

                case Util.Direction.left:
                    newP = new _Point(start.x, start.y - 1, d);
                    break;

                default:
                    return(false);

                    break;
                }

                if (getRoad(newP, end, roads, len - 1))
                {
                    roads.Add(newP);
                    return(true);
                }
            } while (d != Util.Direction.none);

            return(false);
        }
    }
コード例 #7
0
 public List <_Point> makeRoad(_Point start, _Point end, int n, int len)
 {
     N  = n;
     rs = new List <_Point>();
     getRoad(start, end, rs, len);
     rs.Add(start);
     return(rs);
 }
コード例 #8
0
ファイル: Form1.cs プロジェクト: JaredHam777/3dpixels
 public void Rotate(_Point axis, double deg)
 {
     for (int i = 0; i < Points.Count; i++)
     {
         Points[i] = VectMath.Add(VectMath.RotateByAngle(VectMath.Subtract(Points[i], Position), axis, deg), Position);
     }
     Normal = CalculateNormal();
 }
コード例 #9
0
        public static _Model InitSimpleModel()
        {
            _Model m = new _Model();

            _Point q1    = new _Point(100, 0);
            _Point q2    = new _Point(400, 0);
            _Point p1    = new _Point(100, 100);
            _Point p2    = new _Point(400, 100);
            _Point p3    = new _Point(400, 400);
            _Point p4    = new _Point(100, 400);
            _Line  line1 = new _Line(p1, p2);
            _Line  line2 = new _Line(p2, p3);
            _Line  line3 = new _Line(p3, p4);
            _Line  line4 = new _Line(p4, p1);
            _Line  l1    = new _Line(q1, p1);
            _Line  l2    = new _Line(q2, p2);
            _Line  l3    = new _Line(q1, q2);
            _Room  first = new _Room {
                Name = "FirstRoom", Number = 1, type = _RoomType.Kitchen
            };
            _Room second = new _Room {
                Name = "SecondRoom", Number = 2, type = _RoomType.LivingRoom, isStartRoom = true
            };

            first.Lines  = (new List <_Line>()
            {
                line1, line2, line3, line4
            });
            second.Lines = (new List <_Line>()
            {
                l1, l2, l3, line1
            });

            m.rooms.Add(first);
            m.rooms.Add(second);

            foreach (var room in m.rooms)
            {
                room.CanGetBoundarySorted();
            }

            //List<_Point> boundaries = new List<_Point>() { new _Point(50, 0), new _Point(50, 50), new _Point(0, 50), new _Point(0, 500), new _Point(500, 500), new _Point(500, 0) };
            //List<_Point> boundaries = new List<_Point>() { new _Point(-10, -10),  new _Point(-10, 500), new _Point(500, 500), new _Point(500, -10) };
            List <_Point> boundaries = new List <_Point>()
            {
                new _Point(-10, -10), new _Point(-10, 800), new _Point(500, 800), new _Point(500, -10)
            };

            m.OutlinePolygonPoints = boundaries;
            List <System.Windows.Point> convertedPointsForPolygon = boundaries.Select(i => new System.Windows.Point(i.X, i.Y)).ToList();

            m.AvailableOutlinePolygon = new Polygon()
            {
                Points = new PointCollection(convertedPointsForPolygon)
            };

            return(m);
        }
コード例 #10
0
ファイル: Form1.cs プロジェクト: JaredHam777/3dpixels
    public void SetPosition(_Point p)
    {
        _Point MoveVector = VectMath.Subtract(p, Position);

        foreach (Plane plane in Planes)
        {
            plane.SetPosition(VectMath.Add(plane.Position, MoveVector));
        }
        Position = p;
    }
コード例 #11
0
ファイル: Form1.cs プロジェクト: JaredHam777/3dpixels
 public static Boolean IsParallel(_Point a, _Point b)
 {
     if (a.x / b.x == a.y / b.y && a.y / b.y == a.z / b.z)
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
コード例 #12
0
 void Attach(FlexPie fp)
 {
     fp.SliceRendered += (s, a) =>
     {
         center = new _Point(a.CenterX, a.CenterY);
         radius = a.Radius;
     };
     fp.Rendered  += PieOnRendered;
     fp.MouseMove += PieOnMouseMove;
     fp.Click     += OnClick;
 }
コード例 #13
0
ファイル: Form1.cs プロジェクト: JaredHam777/3dpixels
    public void ToUVSphere(double radius, int Numrings)
    {
        Verts    = new List <List <_Point> >();
        Position = new _Point(0, 0, 0);
        Planes   = new List <Plane>();
        double angle     = (180 / Numrings) * (Math.PI / 180);
        double VertAngle = (180 / Numrings) * (Math.PI / 180);

        //for (int i=0; i<2*Numrings; i++)
        //{
        //    Plane plane = new Plane(new List<_Point> {new _Point(0,radius,0), new _Point(radius * Math.Cos(VertAngle) * Math.Sin(angle * (i+1)), radius * Math.Cos(VertAngle), radius * Math.Cos(VertAngle) * -Math.Cos(angle * (i+1))), new _Point(radius * Math.Cos(VertAngle) * Math.Sin(angle * i), radius * Math.Cos(VertAngle), radius * Math.Cos(VertAngle) * -Math.Cos(angle * i)) });
        //    Planes.Add(plane);
        // }

        for (int i = 0; i < Numrings; i++)
        {
            List <_Point> list = new List <_Point>();
            Verts.Add(list);
            for (int j = 0; j < 2 * Numrings; j++)
            {
                Verts[i].Add(new _Point(radius * Math.Sin(VertAngle * i) * Math.Sin(angle * j), radius * Math.Cos(VertAngle * i), radius * Math.Sin(VertAngle * i) * -Math.Cos(angle * j)));
            }
        }
        for (int i = 0; i < Verts.Count - 1; i++)
        {
            for (int j = 0; j < Verts[i].Count - 1; j++)
            {
                Plane plane = new Plane(new List <_Point> {
                    Verts[i + 1][j], Verts[i][j], Verts[i][j + 1], Verts[i + 1][j + 1]
                });
                Planes.Add(plane);
            }
            Plane p = new Plane(new List <_Point> {
                Verts[i + 1][Verts[i].Count - 1], Verts[i][Verts[i].Count - 1], Verts[i][0], Verts[i + 1][0]
            });
            Planes.Add(p);
        }
        for (int i = 0; i < Verts.Count - 1; i++)
        {
            Plane p = new Plane(new List <_Point> {
                Verts[1][i], Verts[0][i], Verts[0][i + 1], Verts[1][i + 1]
            });
            Planes.Add(p);
            p = new Plane(new List <_Point> {
                Verts[Verts.Count - 1][i], Verts[Verts.Count - 2][i], Verts[Verts.Count - 2][i + 1], Verts[Verts.Count - 1][i + 1]
            });
            Planes.Add(p);
        }
        Planes.Add(new Plane(new List <_Point> {
            Verts[1][Verts[1].Count - 1], Verts[0][Verts[0].Count - 1], Verts[0][0], Verts[1][0]
        }));

        SetPosition(new _Point(0, -1, 5));
    }
コード例 #14
0
ファイル: Form1.cs プロジェクト: JaredHam777/3dpixels
 public void GenerateParticles(int num, _Point origin, double radius, _Point velocity)
 {
     Particles = new List <Particle>();
     for (int i = 0; i < num; i++)
     {
         Particles.Add(new Particle(new _Point(origin.x + Globals.rnd.NextDouble() * radius, origin.y + Globals.rnd.NextDouble() * radius, origin.z + Globals.rnd.NextDouble() * radius)));
         //MessageBox.Show(Particles[i].Position.x.ToString());
         Particles[i].velocity = velocity;
         Particles[i].force    = new _Point(0, 0, 0);
         Particles[i].Mass     = 1;
     }
 }
コード例 #15
0
ファイル: Form1.cs プロジェクト: JaredHam777/3dpixels
    public Brush PerceivedColor(LightSource light, _Point CamPosition)
    {
        _Point     LightVector = VectMath.Subtract(this.Position, light.Position);
        _Point     PercVector  = this.Position;
        _Point     Rvector     = VectMath.RotateByAngle(VectMath.Negate(LightVector), Normal, 180);
        double     whitefactor = Math.Abs(.5 * Math.Sin(VectMath.AngleBetween(Normal, LightVector)) + .5);
        double     colorfactor = Math.Abs(Math.Cos(VectMath.AngleBetween(Normal, LightVector)));
        double     Total       = Math.Pow(Math.Sin(VectMath.AngleBetween(PercVector, Rvector)), 2);
        SolidBrush brush       = new SolidBrush(Color.FromArgb(Convert.ToInt32(255 * Total * colorfactor * whitefactor), Convert.ToInt32(255 * Total * whitefactor), Convert.ToInt32(255 * Total * whitefactor)));

        return(brush);
    }
コード例 #16
0
ファイル: Form1.cs プロジェクト: JaredHam777/3dpixels
    public void SetPosition(_Point p)
    {
        //IO.Point(Position);
        _Point DiffVector = VectMath.Subtract(p, Position);

        for (int i = 0; i < Points.Count; i++)
        {
            Points[i] = VectMath.Add(Points[i], DiffVector);
        }
        Position = p;
        Normal   = CalculateNormal();
    }
コード例 #17
0
ファイル: Object.cs プロジェクト: Hriver771/xmlSerialize_test
 public Object()
 {
     this.ShapeType = 0; this.Type = 1;
     this.Transform = new _Transform();
     this.Position = new _Position();
     this.Points = new List<_Point>();
     _Point temp = new _Point(256, 694);
     this.Points.Add(temp);
     _Point temp2 = new _Point(359, 734);
     this.Points.Add(temp);
     this.Label = new _Label();
               
 }
コード例 #18
0
        public override double Distance(double x, double y)
        {
            if (IsInside(x, y))
            {
                return(0);
            }

            var e = (AEllipse)Annotation;
            var c = _layer.Convert(new _Point(e.Location.X, e.Location.Y));
            var a = Math.Atan2(x - c.X, y - c.Y);
            var p = new _Point(c.X + 0.5 * e.Width * Math.Cos(a), c.Y + 0.5 * e.Height * Math.Sin(a));

            return(Distance(x, y, p.X, p.Y));
        }
コード例 #19
0
ファイル: Form1.cs プロジェクト: JaredHam777/3dpixels
 public void Rotate(_Point axis, double angle)
 {
     foreach (Plane plane in Planes)
     {
         for (int i = 0; i < plane.Points.Count; i++)
         {
             _Point p = plane.Points[i];
             //IO.Point(p);
             plane.Points[i] = VectMath.Add(VectMath.RotateByAngle(VectMath.Subtract(p, this.Position), axis, angle), this.Position);
             //IO.Point(plane.Points[i]);
         }
         plane.Position = VectMath.CenterofPoints(plane.Points);
         plane.Normal   = plane.CalculateNormal();
     }
 }
コード例 #20
0
ファイル: Form1.cs プロジェクト: JaredHam777/3dpixels
    public static _Point RotateByAngle(_Point pnt, _Point Axis, double Angle)
    {
        if (VectMath.IsParallel(pnt, Axis) == true)
        {
            return(pnt);
        }
        Angle = (Angle * Math.PI) / 180;
        _Point Avector     = VectMath.Subtract(pnt, VectMath.Project(pnt, Axis));
        double MagAvector  = VectMath.Magnitude(Avector);
        _Point V1          = VectMath.Unit(VectMath.Cross(Axis, Avector));
        _Point V2          = (VectMath.Negate(Avector));
        _Point TransVector = VectMath.Add(VectMath.Scale(V1, MagAvector * Math.Sin(Angle)), VectMath.Scale(V2, (-1 * Math.Cos(Angle) + 1)));

        return(VectMath.Add(TransVector, pnt));
    }
コード例 #21
0
    private void startGameByLevel(int n, int level, _Point start = null, _Point end = null, int requestLeftNum = 0)
    {
        if (null == start || null == end)
        {
            _Point[] ps = Util.getRandomStartAndEndPoint(n, 2);
            start = ps[0];
            end   = ps[1];
        }
        if (requestLeftNum != 0)
        {
            detector           = new RemainStepDetecter();
            parmsForGameEnd    = new object[1];
            parmsForGameEnd[0] = requestLeftNum;
        }

        Cubes.instance.NewGame(start, end, n, level, requestLeftNum);
    }
コード例 #22
0
        public void Update(double x1, double y1, double x2, double y2)
        {
            _start = new _Point(x1, y1);
            _end   = new _Point(x2, y2);

            var start = _layer.ConvertBack(_start);
            var end   = _layer.ConvertBack(_end);

            _ser.Low     = Math.Min(start.Y, end.Y);
            _ser.High    = Math.Max(start.Y, end.Y);
            _ser.MinX    = (double)Math.Min(start.X, end.X);
            _ser.MaxX    = (double)Math.Max(start.X, end.X);
            _ser.Uptrend = start.Y <= end.Y;

            _start = start;
            _end   = end;
        }
コード例 #23
0
    public void NewGame(_Point s, _Point e, int N, int level, int requestLeftNum)
    {//TODO:requestLeftNum这个功能没有实现
        if (this.N != N)
        {
            ClearAll();
            this.N = N;
            Init();
        }

        ClearData();

        List <_Point> rs = RoadManager.instance.makeRoad(s, e, N, level);


        int len = rs.Count;
        int r   = Random.Range(2, len - 2);

        for (int i = 0; i < len; i++)
        {
            if (i == 0 || i == len - 1)
            {
                cubesList[rs[i].x, rs[i].y].setTouchHandler(new StartCubeTouchHandler());
            }
            else if (i == r)
            {
                //          cubesList[rs[i].x, rs[i].y].setTouchHandler(new StepCubeTouchHandler(cubesList[rs[i].x, rs[i].y]));
            }
            cubesList[rs[i].x, rs[i].y].addStep(i + 1);
            cubesList[rs[i].x, rs[i].y].AddCrossTime(1);
        }

        if (requestLeftNum != 0)
        {
            _Point[] pp = Util.getRandomStartAndEndPoint(N, requestLeftNum, false);
            foreach (_Point p in pp)
            {
                cubesList[p.x, p.y].AddCrossTime(1);
            }
        }
    }
コード例 #24
0
        public static _Model InitSimplestModel()
        {
            _Model m     = new _Model();
            _Point p1    = new _Point(100, 100);
            _Point p2    = new _Point(400, 100);
            _Point p3    = new _Point(400, 400);
            _Point p4    = new _Point(100, 400);
            _Line  line1 = new _Line(p1, p2);
            _Line  line2 = new _Line(p2, p3);
            _Line  line3 = new _Line(p3, p4);
            _Line  line4 = new _Line(p4, p1);
            _Room  _Room = new _Room {
                Name = "FirstRoom", Number = 1, type = _RoomType.LivingRoom, isStartRoom = true
            };

            _Room.Lines = (new List <_Line>()
            {
                line1, line2, line3, line4
            });
            m.rooms.Add(_Room);
            foreach (var room in m.rooms)
            {
                room.CanGetBoundarySorted();
            }

            List <_Point> boundaries = new List <_Point>()
            {
                new _Point(0, 0), new _Point(0, 450), new _Point(450, 450), new _Point(450, 0)
            };

            m.OutlinePolygonPoints = boundaries;
            List <System.Windows.Point> convertedPointsForPolygon = boundaries.Select(i => new System.Windows.Point(i.X, i.Y)).ToList();

            m.AvailableOutlinePolygon = new Polygon()
            {
                Points = new PointCollection(convertedPointsForPolygon)
            };
            return(m);
        }
コード例 #25
0
ファイル: Form1.cs プロジェクト: JaredHam777/3dpixels
        public Point convert2D(_Point p)
        {
            if (Camera1.NormalAxis != Axes.Z)
            {
                //IO.Point(p);
                p = VectMath.RotateByAngle(p, VectMath.Cross(Axes.Z, Camera1.NormalAxis), 180 * (VectMath.AngleBetween(new _Point(0, 0, 1), Camera1.NormalAxis)) / Math.PI);
                //IO.Point(p);
            }
            //if( Camera1.VerticalAxis != Axes.Y)
            // {
            //     p = VectMath.RotateByAngle(p, Camera1.NormalAxis, 180*(VectMath.AngleBetween(new _Point(0, 1, 0), Camera1.VerticalAxis))/Math.PI);
            // }
            if (p.z <= 0)
            {
                return(new Point(0, 0));
            }
            int Xcoord = Convert.ToInt32((p.x * Globals.BMSize.Width / 2) / (p.z * Math.Tan(45))) + Globals.BMSize.Width / 2;
            int Ycoord = Convert.ToInt32((-p.y * Globals.BMSize.Height / 2) / (p.z * Math.Tan(45))) + Globals.BMSize.Height / 2;

            p.PF = new PointF(Xcoord, Ycoord);

            return(new Point(Xcoord, Ycoord));
        }
コード例 #26
0
    /// <summary>
    /// 根据N获取地图初始路径长度
    /// </summary>
    /// <param name="N">地图边长</param>
    /// <returns>等级0的时候对应的路径长度</returns>
    public static int getStartLenByN(_Point s, _Point e, int N)
    {
        int startLen = Mathf.Abs(s.x - e.x) + Mathf.Abs(s.y - e.y) + 1;

        return(startLen + (startLen / 4) * 2 - 1);
    }
コード例 #27
0
ファイル: Mouse.Windows.cs プロジェクト: smack0007/Samurai
 private static extern bool _GetCursorPos(out _Point lpPoint);
コード例 #28
0
        public static _Model InitTestModel()
        {
            _Model m = new _Model();

            _Point a1 = new _Point(0, 0);
            _Point a2 = new _Point(0, 100);
            _Point a3 = new _Point(0, 200);
            _Point a4 = new _Point(0, 300);

            _Point a5 = new _Point(100, 0);
            _Point a6 = new _Point(100, 100);
            _Point a7 = new _Point(100, 200);
            _Point a8 = new _Point(100, 300);

            _Point a9  = new _Point(200, 0);
            _Point a10 = new _Point(200, 100);
            _Point a11 = new _Point(200, 200);
            _Point a12 = new _Point(200, 300);

            _Point a13 = new _Point(300, 0);
            _Point a14 = new _Point(300, 100);
            _Point a15 = new _Point(300, 200);
            _Point a16 = new _Point(300, 300);



            _Line l12 = new _Line(a1, a2);
            _Line l23 = new _Line(a2, a3);
            _Line l34 = new _Line(a3, a4);

            _Line l56 = new _Line(a5, a6);
            _Line l67 = new _Line(a6, a7);
            _Line l78 = new _Line(a7, a8);

            _Line l910  = new _Line(a9, a10);
            _Line l1011 = new _Line(a10, a11);
            _Line l1112 = new _Line(a11, a12);

            _Line l1314 = new _Line(a13, a14);
            _Line l1415 = new _Line(a14, a15);
            _Line l1516 = new _Line(a15, a16);


            _Line l15  = new _Line(a1, a5);
            _Line l59  = new _Line(a5, a9);
            _Line l913 = new _Line(a9, a13);

            _Line l26  = new _Line(a2, a6);
            _Line l610 = new _Line(a6, a10);

            l610.Name = "key";
            _Line l1014 = new _Line(a10, a14);

            _Line l37   = new _Line(a3, a7);
            _Line l711  = new _Line(a7, a11);
            _Line l1115 = new _Line(a11, a15);

            _Line l48   = new _Line(a4, a8);
            _Line l812  = new _Line(a8, a12);
            _Line l1216 = new _Line(a12, a16);

            _Room first = new _Room {
                Name = "FirstRoom", Number = 1, type = _RoomType.Kitchen
            };
            _Room second = new _Room {
                Name = "SecondRoom", Number = 1, type = _RoomType.LivingRoom
            };
            _Room third = new _Room {
                Name = "ThirdRoom", Number = 1, type = _RoomType.CorridorRoom
            };
            _Room fourth = new _Room {
                Name = "FourthRoom", Number = 1, type = _RoomType.RestRoom
            };
            _Room fifth = new _Room {
                Name = "fifthRoom", Number = 1, type = _RoomType.BedRoom
            };
            _Room sixth = new _Room {
                Name = "sixthRoom", Number = 1, type = _RoomType.BedRoom
            };
            _Room seventh = new _Room {
                Name = "seventhRoom", Number = 1, type = _RoomType.BedRoom
            };
            _Room eight = new _Room {
                Name = "eightRoom", Number = 1, type = _RoomType.BedRoom
            };
            _Room nineth = new _Room {
                Name = "ninethRoom", Number = 1, type = _RoomType.BedRoom
            };;

            second.isStartRoom = true;


            first.Lines   = (new List <_Line>()
            {
                l12, l26, l56, l15
            });
            second.Lines  = (new List <_Line>()
            {
                l23, l37, l67, l26
            });
            third.Lines   = (new List <_Line>()
            {
                l34, l48, l78, l37
            });
            fourth.Lines  = (new List <_Line>()
            {
                l56, l610, l910, l59
            });
            fifth.Lines   = (new List <_Line>()
            {
                l67, l711, l1011, l610
            });
            sixth.Lines   = (new List <_Line>()
            {
                l78, l812, l1112, l711
            });
            seventh.Lines = (new List <_Line>()
            {
                l910, l1014, l1314, l913
            });
            eight.Lines   = (new List <_Line>()
            {
                l1011, l1115, l1415, l1014
            });
            nineth.Lines  = (new List <_Line>()
            {
                l1112, l1216, l1115, l1516
            });


            m.rooms.Add(first);
            m.rooms.Add(second);
            m.rooms.Add(third);
            m.rooms.Add(fourth);
            m.rooms.Add(fifth);
            m.rooms.Add(sixth);
            m.rooms.Add(seventh);
            m.rooms.Add(eight);
            m.rooms.Add(nineth);

            foreach (var room in m.rooms)
            {
                room.CanGetBoundarySorted();
            }

            return(m);
        }
コード例 #29
0
        public static _Model InitTwoLevelModel()
        {
            _Model m = new _Model();

            _Point a1 = new _Point(0, 0);
            _Point a2 = new _Point(0, 100);
            _Point a3 = new _Point(0, 200);
            _Point a4 = new _Point(0, 300);

            _Point a5 = new _Point(100, 0);
            _Point a6 = new _Point(100, 100);
            _Point a7 = new _Point(100, 200);
            _Point a8 = new _Point(100, 300);

            _Point a9  = new _Point(200, 0);
            _Point a10 = new _Point(200, 100);
            _Point a11 = new _Point(200, 200);
            _Point a12 = new _Point(200, 300);

            _Point a13 = new _Point(300, 0);
            _Point a14 = new _Point(300, 100);
            _Point a15 = new _Point(300, 200);
            _Point a16 = new _Point(300, 300);



            _Line l12 = new _Line(a1, a2);
            _Line l23 = new _Line(a2, a3);
            _Line l34 = new _Line(a3, a4);

            _Line l56 = new _Line(a5, a6);
            _Line l67 = new _Line(a6, a7);
            _Line l78 = new _Line(a7, a8);

            _Line l910  = new _Line(a9, a10);
            _Line l1011 = new _Line(a10, a11);
            _Line l1112 = new _Line(a11, a12);

            _Line l1314 = new _Line(a13, a14);
            _Line l1415 = new _Line(a14, a15);
            _Line l1516 = new _Line(a15, a16);


            _Line l15  = new _Line(a1, a5);
            _Line l59  = new _Line(a5, a9);
            _Line l913 = new _Line(a9, a13);

            _Line l26  = new _Line(a2, a6);
            _Line l610 = new _Line(a6, a10);

            l610.Name = "key";
            _Line l1014 = new _Line(a10, a14);

            _Line l37   = new _Line(a3, a7);
            _Line l711  = new _Line(a7, a11);
            _Line l1115 = new _Line(a11, a15);

            _Line l48   = new _Line(a4, a8);
            _Line l812  = new _Line(a8, a12);
            _Line l1216 = new _Line(a12, a16);

            _Room first = new _Room {
                Name = "FirstRoom", Number = 1, type = _RoomType.Kitchen
            };
            _Room second = new _Room {
                Name = "SecondRoom", Number = 2, type = _RoomType.LivingRoom
            };
            _Room third = new _Room {
                Name = "ThirdRoom", Number = 3, type = _RoomType.CorridorRoom
            };
            _Room fourth = new _Room {
                Name = "FourthRoom", Number = 4, type = _RoomType.DiningRoom
            };
            _Room fifth = new _Room {
                Name = "FifthRoom", Number = 5, type = _RoomType.StairCase
            };
            _Room sixth = new _Room {
                Name = "SixthRoom", Number = 6, type = _RoomType.RestRoom
            };
            _Room seventh = new _Room {
                Name = "SeventhRoom", Number = 7, type = _RoomType.BedRoom
            };
            _Room eight = new _Room {
                Name = "EightRoom", Number = 8, type = _RoomType.BedRoom
            };
            _Room nineth = new _Room {
                Name = "NinethRoom", Number = 9, type = _RoomType.BedRoom
            };;

            second.isStartRoom = true;


            first.Lines   = (new List <_Line>()
            {
                l12, l26, l56, l15
            });
            second.Lines  = (new List <_Line>()
            {
                l23, l37, l67, l26
            });
            third.Lines   = (new List <_Line>()
            {
                l34, l48, l78, l37
            });
            fourth.Lines  = (new List <_Line>()
            {
                l56, l610, l910, l59
            });
            fifth.Lines   = (new List <_Line>()
            {
                l67, l711, l1011, l610
            });
            sixth.Lines   = (new List <_Line>()
            {
                l78, l812, l1112, l711
            });
            seventh.Lines = (new List <_Line>()
            {
                l910, l1014, l1314, l913
            });
            eight.Lines   = (new List <_Line>()
            {
                l1011, l1115, l1415, l1014
            });
            nineth.Lines  = (new List <_Line>()
            {
                l1112, l1216, l1115, l1516
            });


            m.rooms.Add(first);
            m.rooms.Add(second);
            m.rooms.Add(third);
            m.rooms.Add(fourth);
            m.rooms.Add(fifth);
            m.rooms.Add(sixth);
            m.rooms.Add(seventh);
            m.rooms.Add(eight);
            m.rooms.Add(nineth);

            foreach (var room in m.rooms)
            {
                room.CanGetBoundarySorted();
            }

            List <_Point> boundaries = new List <_Point>()
            {
                new _Point(-10, -10), new _Point(-10, 600), new _Point(400, 600), new _Point(400, -10)
            };

            m.OutlinePolygonPoints = boundaries;
            List <System.Windows.Point> convertedPointsForPolygon = boundaries.Select(i => new System.Windows.Point(i.X, i.Y)).ToList();

            m.AvailableOutlinePolygon = new Polygon()
            {
                Points = new PointCollection(convertedPointsForPolygon)
            };

            return(m);
        }
コード例 #30
0
        public static _Model InitNormalModel()
        {
            _Model m  = new _Model();
            _Point a1 = new _Point(0, 0);
            _Point a2 = new _Point(200, 0);
            _Point a3 = new _Point(200, 200);
            _Point a4 = new _Point(0, 200);

            _Point a5 = new _Point(200, 400);
            _Point a6 = new _Point(0, 400);
            _Point a7 = new _Point(400, 0);
            _Point a8 = new _Point(400, 200);
            _Point a9 = new _Point(400, 400);

            _Line l12 = new _Line(a1, a2);
            _Line l23 = new _Line(a2, a3);
            _Line l34 = new _Line(a3, a4);
            _Line l41 = new _Line(a4, a1);

            _Line l35 = new _Line(a3, a5);
            _Line l56 = new _Line(a5, a6);
            _Line l64 = new _Line(a6, a4);

            _Line l27 = new _Line(a2, a7);
            _Line l78 = new _Line(a7, a8);
            _Line l83 = new _Line(a8, a3);

            _Line l89 = new _Line(a8, a9);
            _Line l95 = new _Line(a9, a5);


            _Room first = new _Room {
                Name = "FirstRoom", Number = 1, type = _RoomType.Kitchen
            };
            _Room second = new _Room {
                Name = "SecondRoom", Number = 2, type = _RoomType.LivingRoom
            };
            _Room third = new _Room {
                Name = "ThirdRoom", Number = 3, type = _RoomType.BedRoom
            };
            _Room fourth = new _Room {
                Name = "FourthRoom", Number = 4, type = _RoomType.RestRoom
            };

            first.Lines  = (new List <_Line>()
            {
                l12, l23, l34, l41
            });
            second.Lines = (new List <_Line>()
            {
                l35, l56, l64, l34
            });
            third.Lines  = (new List <_Line>()
            {
                l23, l27, l78, l83
            });
            fourth.Lines = (new List <_Line>()
            {
                l83, l89, l95, l35
            });

            m.rooms.Add(first);
            m.rooms.Add(second);
            m.rooms.Add(third);
            m.rooms.Add(fourth);
            foreach (var room in m.rooms)
            {
                room.CanGetBoundarySorted();
            }
            return(m);
        }
コード例 #31
0
    private List <_Point> roadlist;                       //路径列表



    /// <summary>
    /// 生成路径算法,委托路径生成对象去生成
    /// </summary>
    /// <param name="s">起始点</param>
    /// <param name="e">目标点</param>
    /// <param name="n">生成地图边长</param>
    /// <param name="level">难度等级</param>
    /// <returns></returns>
    public List <_Point> makeRoad(_Point s, _Point e, int n, int level)
    {
        roadlist = roadMaker.makeRoad(s, e, n, Util.getStartLenByN(s, e, n) + level);

        return(roadlist);
    }
コード例 #32
0
ファイル: Mouse.Windows.cs プロジェクト: smack0007/Samurai
 private static extern bool _ScreenToClient(IntPtr hWnd, ref _Point lpPoint);
コード例 #33
0
ファイル: Bringo.cs プロジェクト: ykcycvl/fusion
 public _DeliveryOrder()
 {
     points = new _Point[2];
     points[0] = new _Point();
     points[1] = new _Point();
     delivery = new Delivery();
 }