示例#1
0
        public TriangleEntity(Guid id,CustomType.Polygon polygon)
            : base(id)
        {
            _Polygon = polygon;

            var points = new Queue<CustomType.Vector2>(_Polygon.Points);
            var firstPoint = points.Dequeue();
            float top = firstPoint.Y;
            float down = firstPoint.Y ;
            float left = firstPoint.X;
            float right = firstPoint.X;
            while (points.Count > 0)
            {
                var point = points.Dequeue();
                if (point.X > right)
                {
                    right = point.X;
                }
                if (point.X < left)
                {
                    left = point.X;
                }
                if (point.Y < top)
                {
                    top = point.Y;
                }
                if (point.Y > down)
                {
                    down = point.Y;
                }

            }
            _QuadTreeObjectAbility = new PhysicalAbility(new Regulus.CustomType.Rect(left , top , right - left , down - top ) , this);
            _Polygon.BuildEdges();
        }
示例#2
0
 public TriangleEntity()
 {
     Polygon = new CustomType.Polygon();
 }