コード例 #1
0
        /// <summary>
        /// Return a copy of the current bounding box after scaling all limits relative to 0,0
        /// Scaling does not modify the current bounding box.
        /// </summary>
        /// <remarks>Current object is not modified, a new one is created.</remarks>
        public BoundingBox2d scale(Coord2d factors)
        {
            BoundingBox2d b = new BoundingBox2d();

            b.m_xmax = m_xmax * factors.x;
            b.m_xmin = m_xmin * factors.x;
            b.m_ymax = m_ymax * factors.y;
            b.m_ymin = m_ymin * factors.y;
            return(b);
        }
コード例 #2
0
 /// <summary>
 /// Return true if <paramref name="anotherBox"/> intersects with this box.
 /// </summary>
 public bool intersect(BoundingBox2d anotherBox)
 {
     return((m_xmin <= anotherBox.m_xmin & anotherBox.m_xmin <= m_xmax) | (m_xmin <= anotherBox.m_xmax & anotherBox.m_xmax <= m_xmax) & (m_ymin <= anotherBox.m_ymin & anotherBox.m_ymin <= m_ymax) | (m_ymin <= anotherBox.m_ymax & anotherBox.m_ymax <= m_ymax));
 }
コード例 #3
0
 /// <summary>
 /// Return true if <paramref name="anotherBox"/> is contained in this box.
 /// </summary>
 /// <remarks>if b1.contains(b2), then b1.intersect(b2) as well.</remarks>
 public bool contains(BoundingBox2d anotherBox)
 {
     return(m_xmin <= anotherBox.m_xmin & anotherBox.m_xmax <= m_xmax & m_ymin <= anotherBox.m_ymin & anotherBox.m_ymax <= m_ymax);
 }
コード例 #4
0
 /// <summary>
 /// Adds another <see cref="BoundingBox2d"/> to the bounding box, and enlarge the bounding
 /// box if its points lies outside of it (i.e. merge other bounding box inside current one)
 /// </summary>
 public void @add(BoundingBox2d b)
 {
     this.@add(b.m_xmin, b.m_ymin);
     this.@add(b.m_xmax, b.m_ymax);
 }