# Class BBox

- Defined in File AABBtree.hxx

## Class Documentation

class G2lib::BBox

  Class to manipulate bounding box

  Public Types

  typedef BBox const *PtrBBox

  Public Functions

  inline BBox(real_type xmin, real_type ymin, real_type xmax, real_type ymax, int_type id, int_type ipos)

    Construct a bounding box with additional information

    Parameters

      - xmin – [in] x-minimimum box coordinate

      - ymin – [in] y-minimimum box coordinate

      - xmax – [in] x-maximum box coordinate

      - ymax – [in] y-maximum box coordinate

      - id – [in] identifier of the box

      - ipos – [in] ranking position of the box

  inline BBox(vector<PtrBBox> const &bboxes, int_type id, int_type ipos)

    Build a buonding box that cover a list of bounding box

    Parameters

      - bboxes – [in] list of bounding box

      - id – [in] identifier of the box

      - ipos – [in] ranking position of the box

  inline real_type Xmin() const

    x-minimum coordinate of the bbox

  inline real_type Ymin() const

    y-minimum coordinate of the bbox

  inline real_type Xmax() const

    x-maximum coordinate of the bbox

  inline real_type Ymax() const

    y-maximum coordinate of the bbox

  inline int_type const &Id() const

    return BBOX id

  inline int_type const &Ipos() const

    return BBOX position

  inline BBox const &operator=(BBox const &rhs)

    copy a bbox

  inline bool collision(BBox const &box) const

    detect if two bbox collide

  void join(vector<PtrBBox> const &bboxes)

    Build bbox for a list of bbox

  real_type distance(real_type x, real_type y) const

    distance of the point `(x,y)` to the bbox

  real_type maxDistance(real_type x, real_type y) const

    Maximum distance of the point `(x,y)` to the point of bbox

  inline void print(ostream_type &stream) const

    Pretty print a bbox

  Friends

  friend class AABBtree