Esempio n. 1
0
 public bool IsInteractived(ContourEnvelope envelope, ref bool fullInternal)
 {
     if (envelope.MaxX < _minX || envelope.MinX > _maxX || envelope.MinY > _maxY || envelope._maxY < _minY)
     {
         return(false);
     }
     fullInternal = envelope.MinX > _minX && envelope._maxX <_maxX && envelope.MinY> _minY && envelope._maxY < _maxY;
     return(true);
 }
Esempio n. 2
0
 public bool IsInteractived(ContourEnvelope envelope)
 {
     if (envelope.MaxX < _minX ||
         envelope.MinX > _maxX ||
         envelope.MinY > _maxY ||
         envelope.MaxY < _minY)
     {
         return(false);
     }
     return(true);
 }
Esempio n. 3
0
            public ContourEnvelope Intersect(ContourEnvelope a)
            {
                if (a.MaxX < _minX || a.MinX > _maxX || a.MinY > _maxY || a.MinY < _minY)
                {
                    return(null);
                }
                float minX = Math.Max(_minX, a.MinX);
                float minY = Math.Max(_minY, a.MinY);
                float maxX = Math.Min(_maxX, a.MaxX);
                float maxY = Math.Min(_maxY, a.MaxY);

                return(new ContourEnvelope(minX, maxX, minY, maxY));
            }
Esempio n. 4
0
        public void UpdateEnvelope()
        {
            float minX = float.MaxValue;
            float minY = float.MaxValue;
            float maxX = float.MinValue;
            float maxY = float.MinValue;

            unsafe
            {
                fixed(PointF *ptr0 = this.Points)
                {
                    PointF *ptr = ptr0;

                    for (int i = 0; i < this.Count; i++, ptr++)
                    {
                        if (ptr->X < minX)
                        {
                            minX = ptr->X;
                        }
                        if (ptr->X > maxX)
                        {
                            maxX = ptr->X;
                        }
                        if (ptr->Y < minY)
                        {
                            minY = ptr->Y;
                        }
                        if (ptr->Y > maxY)
                        {
                            maxY = ptr->Y;
                        }
                    }
                }
            }
            _envelope = new ContourEnvelope(minX, maxX, minY, maxY);
        }