NAME

Region2D::Box - create boxes


SYNOPSIS

  use Region2D::Box;
  $box = Region2D::Box->rect_o $xmin, $ymin, $xmax, $ymax;
  $box = Region2D::Box->rect_c $xc, $yc, $x_len, $y_len;
  $box = Region2D::Box->square_c $xc, $yc, $len;
  $box = Region2D::Box->square_ll $xmin, $ymax, $len;
  print $box->area;
  print $box->xlen;
  print $box->ylen;


DESCRIPTION

A simple interface to boxes. Boxes are rectangles which are aligned with the coordinate axes (no rotations for now).

Constructors

rect_c
  $box = Region2D::Box->rect_c $xc, $yc, $x_len, $y_len;

Create a box with the given center ($xc, $yc) and side lengths.

rect_o
  $box = Region2D::Box->rect_o $xmin, $ymin, $xmax, $ymax;

Create a box with the given box corners.

square_c
  $box = Region2D::Box->square_c $xc, $yc, $len;

Create a square box with the given center and side length;

square_ll
  $box = Region2D::Box->square_ll $xmin, $ymax, $len;

Create a square box with the given lower left corner and side length;

Methods

As Box inherits from the Region2D, it implements all of its methods (namely clone(), in(), out(), and area().

xlen
Returns the length of the box in the X direction

ylen
Returns the length of the box in the Y direction

xmin
returns the minimum X value

ymin
returns the minimum Y value

xmax
returns the maximum X value

ymax
returns the maximum Y value

set_xmin
        $box->set_xmin( $xmin );

set the minimum X value

set_xmax
        $box->set_xmax( $xmax );

set the maximum X value

set_ymin
        $box->set_ymin( $ymin );

set the minimum Y value

set_ymax
        $box->set_ymax( $ymax );

set the maximum Y value


AUTHOR

Diab Jerius ( djerius@cfa.harvard.edu )